下載對應的包
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方式升級
檢查現在版本
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包
mysqladmin -u root -p shutdown yum upgrade mysql-community*
啟動數據庫更新系統字典
/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.
重啟數據庫觀察啟動日志
/etc/init.d/mysqld restart