mysql 5.6升级到5.7.22
原创
©著作权归作者所有:来自51CTO博客作者小叔叔书的原创作品,请联系作者获取转载授权,否则将追究法律责任
下载对应的包
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar
备份数据库(至少备份mysql)
innobackupex -uxbackup -u root -p ocm123 --no-timestamp /data/backup/
手动在备一次
mv mysql mysql_bak
建立软连接
ln -s /root/mysql-5.7.22-linux-glibc2.12-x86_64 mysql
查看mysql_upgrade 帮助文档 -s, --upgrade-system-tables Only upgrade the system tables, do not try to upgrade the data.
/etc/init.d/mysqld start
mysql_upgrade -s
/etc/init.d/mysqld restart
到此升级完成,注意观察error日志
上面是二进制升级过程,下面演示通过yum方式升级
检查现在版本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
mysql> select @@version; +------------+ | @@version | +------------+ | 5.7.22-log | +------------+ 1 row in set (0.00 sec)
[root@redis02 ~]# rpm -qa|grep mysql-community* mysql-community-server-5.7.22-1.el6.x86_64 mysql-community-libs-5.7.22-1.el6.x86_64 mysql-community-common-5.7.22-1.el6.x86_64 mysql-community-client-5.7.22-1.el6.x86_64 mysql-community-embedded-devel-5.7.22-1.el6.x86_64 mysql-community-devel-5.7.22-1.el6.x86_64 mysql-community-test-5.7.22-1.el6.x86_64 mysql-community-libs-compat-5.7.22-1.el6.x86_64 mysql-community-embedded-5.7.22-1.el6.x86_64
|
关闭数据库及更新rpm包
1 2
|
mysqladmin -u root -p shutdown yum upgrade mysql-community*
|
启动数据库更新系统字典
1 2 3 4 5 6 7 8 9 10 11 12
|
/etc/init.d/mysqld start mysql_upgrade -u root -p --upgrade-system-tables
[root@redis02 ~]# mysql_upgrade -u root -p --upgrade-system-tables Enter password: The --upgrade-system-tables option was used, databases won't be touched. Checking if update is needed. Checking server version. Running queries to upgrade MySQL server. The sys schema is already up to date (version 1.5.1). Upgrade process completed successfully. Checking if update is needed.
|
重启数据库观察启动日志
1
|
/etc/init.d/mysqld restart
|