环境: mysql5.6 升级 5.7
1.安装mysql5.6
参考官方安装文档:https://dev.mysql.com/doc/refman/5.6/en/binary-installation.html
shell> groupadd mysql shell> useradd -r -g mysql -s /bin/false mysql shell> cd /usr/local shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql shell> cd mysql shell> scripts/mysql_install_db --user=mysql shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
2.升级步骤
注意:安全停止mysql
下载mysql5.7解压到/usr/local目录下
/etc/init.d/mysql.server stop unlink mysql ln -s /usr/local/mysql-5.7.29-linux-glibc2.12-x86_64 /usr/local/mysql
# -s表示只升级系统库,线上运行的库都是几百G以上,如果所有库都升级会很慢,因此只升级系统库即可 mysql_upgrade -s -p"passwd"
这样就升级完成了!