Upgrade MySQL Server from 5.7 to 8 CentOS 7 Linux.

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

The Upgrade of the MySQL server is for the performance and security improvements.

So before upgrading the MySQL servers from 5.7 to 8 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
Upgrade MySQL Server from 5.7 to 8 in CentOS 7, Also find a cheat sheet to Upgrade the MySQL server from 5.7 to 8.0 in CentOS Linux.

So After login to the server, we can see the MySQL version there are many other options to look at the versions of MySQL.

Now let’s see step by step to Upgrade MySQL Server from 5.7 to 8 in CentOS 7. Find the cheat sheet and after Upgrade please come and read the whole post.

Cheat Sheet to Upgrade MySQL from 5.7 to 8 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-8.0.19-1.el7.x86_64.rpm-bundle.tar
$ tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
$ sudo rpm -Uvh *.rpm

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.7

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

$ sudo systemctl stop mysql

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

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-8.0.19-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-8.0.19-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.

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

$ sudo systemctl start mysqld

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

Upgrade MySQL Server from 5.7 to 8 in CentOS 7, Also find a cheat sheet to Upgrade the MySQL server from 5.7 to 8.0 in CentOS Linux.
$ mysql -uroot -pRoot@1234

So here we have successfully upgraded the MySQL server version from 5.7 to 8. You can also check the logs, whether we have successfully upgraded the server or not.

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.

Give your valuable time