1. downloads.mysql.com/archives/community/
2.解压根目录下新建my.ini文件
- [client]
- default-character-set=utf8
-
- [mysqld]
- #端口号
- port = 3306
- #mysql-5.7.38-winx64的路径
- basedir=C:\Tool\MySql\mysql-5.7.38-winx64
- #mysql-5.7.38-winx64的路径+\data
- datadir=C:\Tool\MySql\mysql-5.7.38-winx64\data
- #最大连接数
- max_connections=200
- #编码
- character-set-server=utf8
-
- default-storage-engine=INNODB
-
- sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
-
- [mysql]
- #编码
- default-character-set=utf8
3. 以管理员身份运行cmd,在根目录\bin下输入
mysqld --install
如果显示缺少MSVCP120.dll,是缺少VisualC++运行库,去下面地址下载即可
https://www.microsoft.com/zh-cn/download/details.aspx?id=40784
4.修改MYSQL密码
mysqld --initialize --console
5.保存密码后启动MYSQL服务
net start mysql
6.mysql成功启动后进行密码修改,先进入mysql
mysql -u root -p
输入之前保存的临时密码
7.更改密码,使用quit命令退出mysql
ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘123456’;
8.开启远程访问权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
刷新访问权限
FLUSH PRIVILEGES;