How To Upgrade MariaDB on Centos 7

In this guide, we want to teach you How To Upgrade MariaDB on Centos 7.

MariaDB is a fork of MySQL. In other words, it is an enhanced, drop-in replacement of MySQL.

A drop-in replacement means you can substitute the standard MySQL server with the analog version of the MariaDB server and take full advantage of the MariaDB improvements without needing to modify your application code.

MariaDB is fast, scalable, and robust. It supports more storage engines than MySQL. MariaDB also includes many plugins and tools that make it versatile for lots of use cases.

For version 10.8 some new features include:

  • Lag-free ALTER TABLE in replication.
  • Descending indexes.
  • Auto-create partition.

How To Upgrade MariaDB on Centos 7

To upgrade your MariaDB service, you need some requirements.


First, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Centos 7.

Then, you must have a version of MariaDB running that is not the latest version.

Now follow the steps below to complete this guide.

Upgrading MariaDB on Centos 7

First, you must check the current MariaDB version and Centos version using the below commands:

# mysql -V
mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

Then, you must create a backup or a dump of the existing databases. To do this, run the following command:

mysqldump -u root -p --all-databases > /tmp/database-backup.sql
Next, copy the database directory into a separate folder with the following command:
cp -a /var/lib/mysql /var/lib/mysql.backup
Now you must back up the configuration file with the following command:
cp -a /etc/my.cnf /etc/my.cnf_bk
Note: In case of any failures in the upgrade, you can use one of the above copies to restore your databases.
In this step, you need to uninstall the old MariaDB repositories. To do this, stop your MariaDB service on Centos 7:
systemctl stop mariadb
Verify that your service is stopped:
systemctl status mariadb
‚óŹ mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2022-06-22 05:41:22 EDT; 8s ago
Process: 14541 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 14540 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 14506 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 14540 (code=exited, status=0/SUCCESS)

Move the current MariaDB repository with the following command:

mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb_bk
Then, update your local package index with the following command:
yum update
Next, you need to add the new MariaDB repository. To do this, create a new repo file for the latest version with your favorite text editor, here we use vi:
vi /etc/yum.repos.d/MariaDB.repo

Copy and paste the following contents into the file:

name = MariaDB
baseurl =

When you are done, save and close the file.

Now, you need to remove the MariaDB old version by using the command below on Centos 7:

yum remove mariadb-server
Clean the repository cache:
yum clean all
At this point, you can install the latest version of MariaDB on your server:
yum install MariaDB-server

To install the latest version of MariaDB and the most common packages, run the following command:

yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
Start and enable your MariaDB service to start on boot:
systemctl start mariadb
systemctl enable mariadb
Next, use the following command to upgrade your MariaDB on Centos 7:
mysql_upgrade -u root -p
Verify that you have the latest MariaDB on your server by checking its version:
mysql -V
mysql Ver 15.1 Distrib 10.8.3-MariaDB, for Linux (x86_64) using readline 5.1

For more information, you can visit the MariaDB Documentation page.


At this point, you learn to Upgrade MariaDB on Centos 7 step by step.

Hope you enjoy it.


Please enter your comment!
Please enter your name here

Latest Articles


Most Popular