去发现生活中的美好,记录生活中的点点滴滴

phpstudy升级mysql版本

mysql admin 1641℃

phpstudy默认的mysql版本是5.5,版本过低会影响一些功能的使用,比如timestamp不能设置多个CURRENT_TIMESTAMP等问题。下面介绍升级phpstudy的方法:

先确定phpstudy是32位还是64位,来决定下载的mysql是32位还是64位。

mysql 5.7 32位 下载:https://dev.mysql.com/downloads/file/?id=481159

mysql 5.7 64位 下载:https://dev.mysql.com/downloads/file/?id=481160

QQ截图20181219111224

QQ截图20181219111254

QQ截图20181219111307

1、关闭phpstudy的服务

2、使用cmd打开phpstudy目录下的Mysql目录下的bin文件夹,执行

 

mysqld -remove
mysqld --initialize  //初始化

 

3、备份MySQL目录,清空D:\phpStudy2018\PHPTutorial\MySQL下的所有文件,如果之前有数据库的话,可以保留data目录;

4、将下载好的mysql文件解压,复制到MySQL目录下,强制替换;

5、配置my.ini文件,注意,路径一定要准确:

[client]
port=3306
[mysql]
default-character-set=utf8

[mysqld]
port=3306
basedir="D:/phpStudy2018/PHPTutorial/MySQL/"
datadir="D:/phpStudy2018/PHPTutorial/MySQL/data/"
character-set-server=utf8
#skip-grant-tables

6、进入D:\phpStudy2018\PHPTutorial\MySQL\bin,执行

mysqld install

7、启动服务:

D:\phpStudy2018\PHPTutorial\MySQL\bin>net start MySQL

8、设置密码:
先在my.ini的[mysqld]下,加上skip-grant-tables,保存,重启

net stop MySQL
net start MySQL

执行

mysql -uroot -p  
提示输入密码继续回车,即可进入mysql命令行。

修改密码

mysql> set password for root@localhost = password('123456');

或
mysql> update mysql.user set authentication_string=password('123456') where User
='root' and Host='localhost';

如果报错

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables opt
ion so it cannot execute this statement

执行

mysql> flush privileges; 

再次执行修改密码命令即可。

9、重启,如果只能cmd命令启动mysql,phpstudy 无法启动 mysql的问题,解决:

以管理员身份运行cmd(一定要管理员身份),执行

sc delete MySQL

提示成功,重启phpstudy即可。
10、完成

SELECT VERSION();  -- 5.7.24

如果报以下错误

[Err] 1146 - Table 'performance_schema.session_status' doesn't exist

则进入D:\phpStudy2018\PHPTutorial\MySQL\bin>执行

mysql_upgrade -u root -p --force

即可。

转载请注明:永盟博客 » phpstudy升级mysql版本

喜欢 (1)

Warning: count(): Parameter must be an array or an object that implements Countable in E:\www\blog\wp-includes\class-wp-comment-query.php on line 405