Mysql5.6升級到5.7操作步驟
mysql5.6 升級至 mysql5.7
環境介紹: 舊庫: basedir=/usr/local/mysql-5.6 datadir=/home/mysql config=/home/mysql/my.cnf sock=/home/mysql/mysql.sock sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES character_set_server = utf8 lower_case_table_names=1 skip-host-cache skip-name-resolve federated log-error=/home/mysql/log/mysqld.log pid-file=/home/mysql/master.example.com.pid
[mysql] default-character-set = utf8 socket=/home/mysql/mysql.sock
升級步驟:
1、對mysql5.6進行全庫備份(******)用於失敗倒回 2、關閉mysql5.6版本資料庫 3、將mysql5.7軟體部署 4、修改配置資訊 5、修改啟動指令碼 6、啟動mysql5.7資料庫 7、mysql_upgrade升級資料庫相關引數 8、重啟資料庫,測試升級結果
1、全庫備份 mysqldump -uroot -p123456 --all-databases > /root/mysql_all.sql
2、 關閉資料庫
/usr/local/mysql-5.6/bin/mysqladmin -uroot -p123456 shutdown
驗證 netstat -tnpl|grep :3306
3、 部署mysql5.7 tar xf mysql-5.7.22-el7-x86_64.tar.gz -C /usr/local
cd /usr/local mv mysql-5.7.22 mysql5.7
4、修改配置資訊
vim /home/mysql/my.cnf basedir=/usr/local/mysql5.7 ---修改
5、修改啟動指令碼 cp /usr/local/mysql5.7/support-files/mysql.server /etc/init.d/mysql5.7
vim /etc/init.d/mysql5.7 basedir=/usr/local/mysql5.7 datadir=/home/mysql
6、啟動mysql5.7 service mysql5.7 start
[[email protected] ~]# netstat -tnpl |grep :3306 tcp6 0 0 :::3306 :::* LISTEN 8820/mysqld
[[email protected] mysql]# mysql -uroot -p123456 mysql: [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 2 Server version: 5.7.22 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.
7、mysql_upgrade升級資料庫相關引數 mysql_upgrade -uroot -p123456 mysql> select user,host, authentication_string from mysql.user; +---------------+--------------------+-------------------------------------------+ | user | host | authentication_string | +---------------+--------------------+-------------------------------------------+ | root | localhost | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | root | master.example.com | | | root | 127.0.0.1 | |
測試升級成功