1. 程式人生 > >centos升級MySQL數據庫5.6.39

centos升級MySQL數據庫5.6.39

升級

MySQL數據庫升級3.6.39

準備工作:
1.新建目錄(把升級文件放在此目錄中)
[root@localhost /]# mkdir /mysqlbak
[root@localhost /]#
2.上傳升級的數據庫版本:
.https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.39-1.el7.x86_64.rpm-bundle.tar

3.解壓
[root@localhost 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

備份數據庫
註:升級數據庫理論是不影響數據的,安全起見備份數據庫
[root@localhost /]# mysqldump -uroot -P 3306 -p -A > /mysqlbak/dabatases.sql

Enter password:
You have new mail in /var/spool/mail/root
[root@localhost /]#

停止數據庫
[root@localhost mysqlbak]# service crond stop
Redirecting to /bin/systemctl stop crond.service
You have new mail in /var/spool/mail/root
[root@localhost mysqlbak]# service mysql stop
Shutting down MySQL..................... SUCCESS!

[root@localhost mysqlbak]# netstat -lntup | grep 3306
[root@localhost mysqlbak]#

刪除舊版本MySQL包文件
[root@localhost mysqlbak]# yum remove MySQL-share MySQL-client MySQL-devel MySQL-server MySQL-shared

安裝新的MySQL包文件
[root@localhost 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%]
[root@localhost 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%]
[root@localhost 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%]
[root@localhost 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%]
[root@localhost 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%]
[root@localhost 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%]
[root@localhost 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
[root@localhost hy]# /etc/init.d/mysql start
Starting MySQL....... SUCCESS!
[root@localhost 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>

centos升級MySQL數據庫5.6.39