windows7x64系统中配置mysql5.7.17为本地开发环境(win2008类似)

1. 下载mysql压缩包mysql-5.7.17-winx64.zip
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.17-winx64.zip
2. 解压文件,解压后mysql根目录为:D:\mysql\mysql-5.7.17-winx64
3. 创建my-default.ini的副本为my.ini
4. 系统环境变量path中加入D:\mysql\mysql-5.7.17-winx64\bin
5. 命令行运行:
mysqld --initialize(初始化数据库)
mysqld -install(注册windows服务默认名为MySQL)
6. (有可能初始化时已经自动完成了)打开注册表regedit,路径为HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MySQL,找到字符串ImagePath,将值更改为"D:\mysql\mysql-5.7.17-winx64\bin\mysqld" MySQL
7. 启动服务(在services.msc中,或命令行net start mysql)
8. 修改my.ini,在[mysqld]段中加入一行skip-grant-tables
9. 重启mysql服务(命令行net stop mysql,net start mysql)
10. 命令行mysql -u root可直接登录
11. 设置root密码为root
update mysql.user set authentication_string=password('root') where user='root' and host='localhost';
flush privileges;
quit
12. 修改my.ini将skip-grant-tables用#号注释
13. 再次重启mysql服务
14. mysql -u root -proot连接mysql
15. 设置root可远程连接
set password=password('root');
alter user 'root'@'localhost' password expier never;
flush privileges;
(如果出错,这里可以退出重新连接)
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;
16. 完毕!

你可能感兴趣的:(windows7x64系统中配置mysql5.7.17为本地开发环境(win2008类似))