How To Upgrade MariaDB to 10.4 on CentOS

How To Upgrade MariaDB to 10.4 on CentOS

MariaDB is one of the famous MySQL database servers. MariaDB Community Server is an open-source relational database used by developers all over the world. This MariaDB is fully compatible with MySQL. With the Linux system, MariaDB works as a backend. It offers high performance and can handle high loads. It also supports query cache, and we can further optimize it. In this tutorial, we will learn how to Upgrade MariaDB to 10.4 on CentOS.

Backup or Dump All MariaDB Databases

Creating backup is very important before performing the upgrade. If any unexpected happens, then we can restore the databases from the backup file. If you want to learn How to Back Up and Restore MySQL Databases then you can visit one of our popular blogs.

To create the Backup of a single database, then run the following command. Replace “/root/” with your desired path if you want to create the backup at a different path.

mysqldump -u user -p database_name > /root/database_name.sql

To create the Backup of all databases, then run the following command.

mysqldump -u root -p'password' --all-databases > /root/all-database.sql

Stop the MariaDB service.

systemctl stop mariadb.service

Create the backup of Database directory.

cp -a /var/lib/mysql/ /var/lib/mysql.bak

Add the MariaDB Repository

We need to add the MariaDB 10.4 repository for CentOS. Open the below file in your favorite text editors, such as vim or nano.

vim /etc/yum.repos.d/MariaDB.repo

Copy and paste the following data into the repository file.

# MariaDB 10.4 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]

name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Start the upgrade of MariaDB

Run the following command to start the MariaDB upgrade process.

yum install MariaDB-client MariaDB-server

Restart the MariaDB service.

systemctl restart mariadb.service

Enable the MariaDB service.

systemctl enable mariadb.service

Upgrade MySQL databases

After upgrading the MariaDB server, we need to upgrade all the databases. Run the following command to upgrade the databases.

mysql_upgrade -u root -p'password'

Restart the MariaDB service.

systemctl restart mariadb.service

Conclusion

In this tutorial, we have learned how to Upgrade MariaDB to 10.4 on CentOS by adding the MariaDB Repository. You can also learn about the MySQL installation, MySQL user and database, MySQL backup and restore from our other blogs.

If you guys have any queries related to this tutorial, then let me know in the comments section.