赞
踩
[root@test1 opt]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@test1 opt]# mysqld -V
[root@test1 mysql]# mysqld -V
mysqld Ver 5.7.26 for Linux on x86_64 (MySQL Community Server (GPL))
[root@test1 mysql]# mysqld -V
mysqld Ver 5.7.33 for Linux on x86_64 (MySQL Community Server (GPL))
如果服务器未联网,可以登录官网下载后上传,下载所需版本的安装包及依赖包,然后从第4步开始升级步骤。
[root@test1 opt]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@test1 opt]# rpm -ivh mysql57-community-release-el7-10.noarch.rpm
[root@test1 opt]# yumdownloader --resolve mysql-community-server
[root@test1 opt]# rpm -qa |grep mysql
mysql-community-common-5.7.26-1.el7.x86_64
mysql-community-client-5.7.26-1.el7.x86_64
mysql-community-server-5.7.26-1.el7.x86_64
mysql-community-libs-5.7.26-1.el7.x86_64
备份前设置锁,只读
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)
备份整个数据库
[root@test1 tmp]# mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > dataall.sql
Enter password:
[root@test1 tmp]#
[root@test1 tmp]# cp /etc/my.cnf /tmp/my.cnf.bak
[root@test1 tmp]# mysql -u root -p --execute=“SET GLOBAL innodb_fast_shutdown=0”
Enter password:
亲测可以不关闭数据库,升级完成后数据库将自动重启。
[root@test1 mysql]# rpm -Uvh mysql-community-common-5.7.33-1.el7.x86_64.rpm --nodeps
warning: mysql-community-common-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-common-5.7.33-1.e################################# [ 50%]
Cleaning up / removing…
2:mysql-community-common-5.7.26-1.e################################# [100%]
[root@test1 mysql]# rpm -Uvh mysql-community-server-5.7.33-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-server-5.7.33-1.e################################# [ 50%]
Cleaning up / removing…
2:mysql-community-server-5.7.26-1.e################################# [100%]
[root@test1 mysql]# mysqld -V
mysqld Ver 5.7.33 for Linux on x86_64 (MySQL Community Server (GPL))
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)
[root@test1 mysql]# mysql_upgrade -uroot -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
…
Upgrade process completed successfully.
Checking if update is needed.
[root@test1 opt]# rpm -Uvh mysql-community-client-5.7.33-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.33-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:mysql-community-client-5.7.33-1.e################################# [ 50%]
Cleaning up / removing…
2:mysql-community-client-5.7.26-1.e################################# [100%]
[root@test1 opt]# mysql -V
mysql Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using EditLine wrapper
error: Failed dependencies:
mysql-community-common(x86-64) = 5.7.26-1.el7 is needed by (installed) mysql-community-server-5.7.26-1.el7.x86_64
原因:common包被server依赖
解决方案:加上–nodeps参数执行升级
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。