MySQL upgrade from 5.6 to 5.7 Linux CentOS.

We will Upgrade MySQL Server from 5.6 to 5.7 in CentOS 7, Linux by using the command line in a few steps.

The MySQL upgrade server is for the performance and security improvements.

So before upgrading the MySQL servers from 5.6 to 5.7 take the backup of databases and the configuration files.

To take the backup use the “mysqldump” command and backup all the databases with the Master user of the databases.

$ mysqldump --lock-all-tables --all-databases -uroot -proot > all_databases.sql

So, after taking the backup of the mysql databases take the backup of the configuration file using the “cp commandin the terminal.

$ sudo cp /etc/my.cnf /etc/my.cnf_bkp

Also, you can check the version of the database by login into the MySQL database.

$ mysql -uroot -proot
mysql upgrade from 5.6 to 5.7

So After login into the server, we can see the MySQL version there are many other options to look at the versions of MySQL like (@@version in Workbench).

Now let’s see step by step to MySQL Upgrade from 5.6 to 5.7 in CentOS 7.

Find the cheat sheet and after Upgrade please come and read the whole post for better knowledge.

Cheat Sheet to MySQL Upgrade from 5.6 to 5.7 in CentOS 7

1. Stop the MySQL server.

$ sudo systemctl stop mysql

2. Download the Package and Install the Package.

$ wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
$ tar -xvf  mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
$ sudo rpm -Uvh *.rpm
$ sudo mysql_upgrade -uroot -proot

3. Check the Version of MySQL Server which is running after Upgrade.

$ sudo systemctl status mysqld
$ mysql -uroot -proot

STEP 1: Stop the MySQL server 5.6

So, before upgrading, we will stop the MySQL server 5.6 in CentOS by using the “systemctl command”.

$ sudo systemctl stop mysql

STEP 2: Download the Package and Upgrade the Package of MySQL 5.7

So when the server gets stopped we will download the package by using the “wget command”.

$ wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar

We have downloaded the package, if you want to download the package of any other version can visit the official website of MySQL.

Now let’s extract the package with the tar command from the command line terminal.

$ tar -xvf mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar

So, now let’s use the rpm command to upgrade the package of MySQL.

$ sudo rpm -Uvh *.rpm

-U option is used to upgrade the package, -v is to display the message, and -h is print hash so that we can see the progress.

mysql upgrade from 5.6 to 5.7

So, now we will start the MySQL server by using “systemctl command”.

$ sudo systemctl start mysqld

Now we will use the command “mysql_upgrade” to upgrade the existing database and the tables to 5.7 version

$ sudo mysql_upgrade -uroot -proot
mysql upgrade from 5.6 to 5.7

STEP 3: Check the Version of MySQL Server which is running after Upgrade.

So to check the version firstly we will check the status by using “systemctl”

$ sudo systemctl status mysqld.

Now login to the server to check the version of MySQL version

mysql upgrade from 5.6 to 5.7
$ mysql -uroot -proot

So here we have successfully upgraded the MySQL server version from 5.6 to 5.7 .

Learn more about how to install MySQL 8 in CentOS and Ubuntu, how to upgrade MySQL 5.5 to 5.7, how to upgrade MySQL 5.7 to 8 on Ubuntu.

One Reply to “MySQL upgrade from 5.6 to 5.7 Linux CentOS.”

Give your valuable time