Upgrade MySQL 5.6 to 5.7 on Centos 7

0
481
Upgrade MySQL 5.6 to 5.7 on Centos 7

Here we can see “Upgrade MySQL 5.6 to 5.7 on Centos 7”

  1. Important backup your databases before the update. Create a copy of the first MySQL data. You will lose all of your information.
$ mysqldump -v -u root -p --all-databases > /tmp/backups/mysql56_all_databases_dump.`date +%F`.sql  
  1. Halt the mysql database and then copy db documents
$ systemctl stop mysqld
$ cp /var/lib/mysql /var/lib/mysql56.backup

3. Download the MySQL 5.7 RPM

$ wget http://repo.mysql.com/mysql57-community-release-el7.rpm -P /tmp/

4. Eliminate the MySQL-Community RPM, which includes MySQL 5.6

$ yum remove mysql-community-release

5. Install the MySQL 5.7 RPM

$ rpm -ivh /tmp/mysql57-community-release-el7.rpm

6. Update the MySQL Repository into 5.7

$ yum update mysql

7. Let MySQL understand that it obtained an update

# sudo systemctl start mysqld
# sudo systemctl status mysqld
# mysql_upgrade

8. Restart MySQL after update

# sudo systemctl restart mysqld
# sudo systemctl status mysqld
# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.22 MySQL Community Server (GPL)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)