How to upgrade MariaDB on CentOS 7

Upgrading MariaDB from version 5.5.64 to 10.5.2

In this article we’re going to cover the upgrade of MariaDB from its current version 5.5.64 to the newest 10.5.2, as you probably know we’re running LAMP using CentOS 7 as the host OS, and MariaDB was installed using YUM,

MariaDB current version

By default YUM always install the stable version of MariaDB, at the moment of the installation that version was 5.5.64, you can check the current version of MariaDB using the following CLI command.

mysql --version
MariaDB current version 5.5.64

Step 1 – Update your system

As the best practices dictate, it’s always a good idea to make sure your system is up to date, you can update CentOS 7 using the CLI command below.

yum  -y update

Step 2 – Stop MariaDB

Stopping MariaDB is mandatory to avoid ending up with an inconsistent state afterwards, this step also allows us to make a backup of the database directory that is the next step.

systemctl stop mariadb
MariaDB current status – Inactive (dead)

Step 3 – Create a new directory

In our case we’re creating our first backup and because of that we’re going to create a folder where this and future backups will be saved, you can use “mkdir” command as follow adapting it to your own preferences.

mkdir /opt/daniel_mariadb-backups
MariaDB backup folder
Custom folder to save MariaDB backups

Step 4 – Run the backup command

Here once again we’ve decided to include the date on each backup, feel free to reuse the following CLI command and adapt it ot your own needs.

tar cfvz /opt/daniel_mariadb-backups/daniel_mariadb-$(date +%F).tar.gz /var/lib/mysql/*
MariaDB backup completed

Step 5 – create repo file

We’re going to use the Tee command to create the repo file in just one step, see below.

tee /etc/yum.repos.d/MariaDB.repo<<EOF
name = MariaDB
baseurl =
gpgkey =
gpgcheck = 1 

Step 6 – Upgrade

You’ve probably noticed in the repo file the new version of MariaDB that is going to be installed, in case you don’t it is 10.5, use the following CLI command to start the upgrade.

yum -y upgrade maria*

MariaDB upgrade log

[root@centos7 ~]# yum -y upgrade maria*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * remi-php73:
 * remi-safe:
 * updates:
mariadb                                                                                                       | 2.9 kB  00:00:00     
mariadb/primary_db                                                                                            |  55 kB  00:00:16     
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.5.2-1.el7.centos will be obsoleting
--> Processing Dependency: MariaDB-common for package: MariaDB-client-10.5.2-1.el7.centos.x86_64
--> Processing Dependency: for package: MariaDB-client-10.5.2-1.el7.centos.x86_64
---> Package MariaDB-compat.x86_64 0:10.5.2-1.el7.centos will be obsoleting
---> Package MariaDB-server.x86_64 0:10.5.2-1.el7.centos will be obsoleting
--> Processing Dependency: galera-4 for package: MariaDB-server-10.5.2-1.el7.centos.x86_64
---> Package mariadb.x86_64 1:5.5.64-1.el7 will be obsoleted
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be obsoleted
---> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be obsoleted
--> Running transaction check
---> Package MariaDB-common.x86_64 0:10.5.2-1.el7.centos will be installed
---> Package galera-4.x86_64 0:26.4.4-1.rhel7.el7.centos will be installed
---> Package pcre2.x86_64 0:10.23-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                         Arch                    Version                                      Repository                Size
 MariaDB-client                  x86_64                  10.5.2-1.el7.centos                          mariadb                   12 M
     replacing  mariadb.x86_64 1:5.5.64-1.el7
 MariaDB-compat                  x86_64                  10.5.2-1.el7.centos                          mariadb                  2.2 M
     replacing  mariadb-libs.x86_64 1:5.5.64-1.el7
 MariaDB-server                  x86_64                  10.5.2-1.el7.centos                          mariadb                   26 M
     replacing  mariadb-server.x86_64 1:5.5.64-1.el7
Installing for dependencies:
 MariaDB-common                  x86_64                  10.5.2-1.el7.centos                          mariadb                   81 k
 galera-4                        x86_64                  26.4.4-1.rhel7.el7.centos                    mariadb                  9.5 M
 pcre2                           x86_64                  10.23-2.el7                                  base                     201 k

Transaction Summary
Install  3 Packages (+3 Dependent packages)

Total download size: 51 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mariadb/packages/MariaDB-common-10.5.2-1.el7.centos.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 1bb943db: NOKEY
Public key for MariaDB-common-10.5.2-1.el7.centos.x86_64.rpm is not installed
(1/6): MariaDB-common-10.5.2-1.el7.centos.x86_64.rpm                                                          |  81 kB  00:00:16     
(2/6): MariaDB-compat-10.5.2-1.el7.centos.x86_64.rpm                                                          | 2.2 MB  00:00:01     
(3/6): MariaDB-client-10.5.2-1.el7.centos.x86_64.rpm                                                          |  12 MB  00:00:19     
(4/6): galera-4-26.4.4-1.rhel7.el7.centos.x86_64.rpm                                                          | 9.5 MB  00:00:02     
(5/6): MariaDB-server-10.5.2-1.el7.centos.x86_64.rpm                                                          |  26 MB  00:00:12     
(6/6): pcre2-10.23-2.el7.x86_64.rpm                                                                           | 201 kB  00:00:15     
Total                                                                                                1.4 MB/s |  51 MB  00:00:35     
Retrieving key from
Importing GPG key 0x1BB943DB:
 Userid     : "MariaDB Package Signing Key <>"
 Fingerprint: 1993 69e5 404b d5fc 7d2f e43b cbcb 082a 1bb9 43db
 From       :
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : MariaDB-compat-10.5.2-1.el7.centos.x86_64                                                                         1/9 
  Installing : MariaDB-common-10.5.2-1.el7.centos.x86_64                                                                         2/9 
  Installing : pcre2-10.23-2.el7.x86_64                                                                                          3/9 
  Installing : MariaDB-client-10.5.2-1.el7.centos.x86_64                                                                         4/9 
  Installing : galera-4-26.4.4-1.rhel7.el7.centos.x86_64                                                                         5/9 
  Installing : MariaDB-server-10.5.2-1.el7.centos.x86_64                                                                         6/9 
  Erasing    : 1:mariadb-server-5.5.64-1.el7.x86_64                                                                              7/9 
warning: /var/log/mariadb/mariadb.log saved as /var/log/mariadb/mariadb.log.rpmsave
  Erasing    : 1:mariadb-5.5.64-1.el7.x86_64                                                                                     8/9 
  Erasing    : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                9/9 
  Verifying  : pcre2-10.23-2.el7.x86_64                                                                                          1/9 
  Verifying  : MariaDB-server-10.5.2-1.el7.centos.x86_64                                                                         2/9 
  Verifying  : MariaDB-common-10.5.2-1.el7.centos.x86_64                                                                         3/9 
  Verifying  : MariaDB-client-10.5.2-1.el7.centos.x86_64                                                                         4/9 
  Verifying  : MariaDB-compat-10.5.2-1.el7.centos.x86_64                                                                         5/9 
  Verifying  : galera-4-26.4.4-1.rhel7.el7.centos.x86_64                                                                         6/9 
  Verifying  : 1:mariadb-libs-5.5.64-1.el7.x86_64                                                                                7/9 
  Verifying  : 1:mariadb-5.5.64-1.el7.x86_64                                                                                     8/9 
  Verifying  : 1:mariadb-server-5.5.64-1.el7.x86_64                                                                              9/9 

  MariaDB-client.x86_64 0:10.5.2-1.el7.centos                       MariaDB-compat.x86_64 0:10.5.2-1.el7.centos                      
  MariaDB-server.x86_64 0:10.5.2-1.el7.centos                      

Dependency Installed:
  MariaDB-common.x86_64 0:10.5.2-1.el7.centos      galera-4.x86_64 0:26.4.4-1.rhel7.el7.centos      pcre2.x86_64 0:10.23-2.el7     

  mariadb.x86_64 1:5.5.64-1.el7           mariadb-libs.x86_64 1:5.5.64-1.el7           mariadb-server.x86_64 1:5.5.64-1.el7          


Step 7 – Restart MariaDB

systemctl restart mariadb

Step 8 – Check MariaDB status

systemctl status mariadb

Step 9 – Enable MariaDB at boot

systemctl enable mariadb

Step 10 – Check MariaDB new version

mysql --version
MariaDB new version 10.5.2