背景
生产环境安扫,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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示