MySql安装

去官网下载相应最新的安装包
https://dev.mysql.com/downloads/mysql/

相关图片

安装

添加环境变量

环境变量

配置MySql相关参数

这里建议复制my-default.ini文件重命名为my.ini(该文件放在项目根目录)

复制后相关参数配置

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
#default-character-set=utf8
# 设置mysql的安装目录
basedir=D:\mysql-5.7.19-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\mysql-5.7.19-winx64\data
#设置3306端口
port=3306
# server_id = .....
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 允许最大连接数
max_connections=200
#使其支持大小写
lower_case_table_names=2
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

执行命令:下载后解压进入bin目录下执行
mysqld –initialize-insecure –user=mysql:不设置密码登陆(用户名默认是root)
mysqld –install:安装mysql服务
net start mysql:启动MySql
net stop mysql:停止MySql

mysqld --initialize-insecure --user=mysql
mysqld --install
net start mysql

若安装遇到 安装mysql Install/Remove of the Service Denied!错误的解决办法请尝试使用管理员身份运行

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。
C:\WINDOWS\system32>D:
D:\>cd mysql-5.7.16-winx64
D:\mysql-5.7.16-winx64>cd bin
D:\mysql-5.7.16-winx64\bin>mysqld --initialize-inscure
D:\mysql-5.7.16-winx64\bin>mysqld -install
Service successfully installed.
D:\mysql-5.7.16-winx64\bin>net start mysql
MySQL 服务正在启动 .

MySql相关密码修改


C:\mysql\mysql-5.7.18-winx64\bin>mysqld -nt --skip-grant-tables

C:\mysql\mysql-5.7.18-winx64\bin>mysqladmin -u root flush-privileges password root
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

C:\mysql\mysql-5.7.18-winx64\bin>mysqladmin -u root -p shutdown
Enter password: ****

C:\mysql\mysql-5.7.18-winx64\bin>mysql -uroot
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

C:\mysql\mysql-5.7.18-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。

关于大小写和更详细配置文件,参考如下链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值