将phpStudy的mysql版本升级至5.7

查看当前的mysql版本

select version()

1.备份数据库 清空mysql安装目录

2.下载5.7版本 官网下载地址

3.解压压缩包 并复制到原mysql安装目录

4.新增mysql的配置文件my.ini配置内容如下

[mysqld]
port=3306
mysqld --skip-grant-tables
basedir="D:/phpStudy/PHPTutorial/MySQL/"
datadir="D:/phpStudy/PHPTutorial/MySQL/data/"
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

5.初始化数据库 进入mysql的bin目录 执行命令

 mysql --initialize

6.安装服务

mysql -install

7.启动服务

net start MySQL

8.登陆mysql

mysql -u root -p 
直接回车 不需要密码

9.设置root密码 并刷新权限

update user set authentication_string=password("root") where user="root";

FLUSH PRIVILEGES;

10.去掉配置文件中的

mysqld --skip-grant-tables

11.移除mysql服务器

C:\Users\Administrator>mysqld --remove
Failed to remove the service because the service is running
Stop the service and try again

12.phpStudy安装服务

    其它菜单选项==>服务管理器==>Mysql==>安装服务

13.重启mysql服务

14.此时可以用设置的密码登陆

猜你喜欢

转载自blog.51cto.com/6292848/2376776