MySQL数据库升级3.6.39
准备工作:
1.新建目录(把升级文件放在此目录中)
[[email protected] /]# mkdir /mysqlbak
[[email protected] /]#
2.上传升级的数据库版本:
.https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.39-1.el7.x86_64.rpm-bundle.tar
3.解压
[[email protected] mysqlbak]# tar vxf MySQL-5.6.39-1.el7.x86_64.rpm-bundle.tar
MySQL-shared-compat-5.6.39-1.el7.x86_64.rpm
MySQL-client-5.6.39-1.el7.x86_64.rpm
MySQL-devel-5.6.39-1.el7.x86_64.rpm
MySQL-server-5.6.39-1.el7.x86_64.rpm
MySQL-shared-5.6.39-1.el7.x86_64.rpm
MySQL-test-5.6.39-1.el7.x86_64.rpm
MySQL-embedded-5.6.39-1.el7.x86_64.rpm
备份数据库
注:升级数据库理论是不影响数据的,安全起见备份数据库
[[email protected] /]# mysqldump -uroot -P 3306 -p -A > /mysqlbak/dabatases.sql
Enter password:
You have new mail in /var/spool/mail/root
[[email protected] /]#
停止数据库
[[email protected] mysqlbak]# service crond stop
Redirecting to /bin/systemctl stop crond.service
You have new mail in /var/spool/mail/root
[[email protected] mysqlbak]# service mysql stop
Shutting down MySQL..................... SUCCESS!
[[email protected] mysqlbak]# netstat -lntup | grep 3306
[[email protected] mysqlbak]#
删除旧版本MySQL包文件
[[email protected] mysqlbak]# yum remove MySQL-share MySQL-client MySQL-devel MySQL-server MySQL-shared
安装新的MySQL包文件
[[email protected] mysqlbak]# rpm -ivh MySQL-client-5.6.39-1.el7.x86_64.rpm
warning: MySQL-client-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-client-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-devel-5.6.39-1.el7.x86_64.rpm
warning: MySQL-devel-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-devel-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-embedded-5.6.39-1.el7.x86_64.rpm
warning: MySQL-embedded-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-embedded-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-shared-5.6.39-1.el7.x86_64.rpm
warning: MySQL-shared-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-shared-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-shared-compat-5.6.39-1.el7.x86_64.rpm
warning: MySQL-shared-compat-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-shared-compat-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-test-5.6.39-1.el7.x86_64.rpm
warning: MySQL-test-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-test-5.6.39-1.el7 ################################# [100%]
[[email protected] mysqlbak]# rpm -ivh MySQL-server-5.6.39-1.el7.x86_64.rpm
warning: MySQL-server-5.6.39-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:MySQL-server-5.6.39-1.el7 ################################# [100%]
登陆升级后MySQL
[[email protected] hy]# /etc/init.d/mysql start
Starting MySQL....... SUCCESS!
[[email protected] hy]# mysql -uroot -pBjqdsc402
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.39 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql> show databases; +--------------------+ |
Database | +--------------------+ | mysql | performance_schema | test |
---|
+--------------------+
7 rows in set (0.05 sec)
mysql>select version();
+-----------+
| version() |
+-----------+
| 5.6.39 |
+-----------+
1 row in set (0.08 sec)
mysql>
原文地址:http://blog.51cto.com/891023/2093071