首页  :: 新随笔  :: 管理

MySQL 5.7.33更新补丁到5.7.38

Posted on 2022-08-31 11:06  高&玉  阅读(1661)  评论(0编辑  收藏  举报

背景

  生产环境安扫,MySQL被扫描出一堆漏洞,需要将生产环境的MySQL 5.7.33更新补丁到5.7.38。

CentOS 7.6

MySQL 5.7.33

升级步骤

下载MySQL 5.7.38

[root]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-el7-x86_64.tar.gz

 

1. 关闭mysql服务

mysql> set global innodb_fast_shutdown = 0;
[mysql]# /etc/init.d/mysql stop

 

2. 替换二进制包

[root]# tar -zxvf mysql-5.7.38-el7-x86_64.tar.gz -C /usr/local/
[root]# unlink /usr/local/mysql
[root]# ln -s /usr/local/mysql-5.7.38-el7-x86_64 /usr/local/mysql
[root]# chown -R mysql:mysql /usr/local/mysql*

 

3. 启动mysql服务

[mysql]# /etc/init.d/mysql start

 

4. 检查旧版本与新版本的兼容性并升级mysql库(mysql_upgrade忘记在哪个版本已经弃用了)

[mysql]# mysql_upgrade -uroot -p
The mysql_upgrade client is now deprecated. The actions executed by the upgrade client are now done by the server.
To upgrade, please start the new MySQL binary with the older data directory. Repairing user tables is done automatically. Restart is not required after upgrade.
The upgrade process automatically starts on running a new MySQL binary with an older data directory. To avoid accidental upgrades, please use the --upgrade=NONE option with the MySQL binary. The option --upgrade=FORCE is also provided to run the server upgrade sequence on demand.
It may be possible that the server upgrade fails due to a number of reasons. In that case, the upgrade sequence will run again during the next MySQL server start. If the server upgrade fails repeatedly, the server can be started with the --upgrade=MINIMAL option to start the server without executing the upgrade sequence, thus allowing users to manually rectify the problem.

 

参考官方文档:https://dev.mysql.com/doc/refman/5.7/en/upgrade-binary-package.html