How to Upgrade MariaDB on Centos 7

In this tutorial we are going to provide you with step-by-step instructions on how to upgrade MariaDB on a CentOS 7 VPS. MariaDB is an open source, community-developed fork of the MySQL relational database management system. MariaDB is highly compatible with MySQL, ensuring exact matching with MySQL commands and APIs.

The upgrade process should take about 10 minutes if you follow the easy steps described below.

In order to check the current MariaDB version installed on your server, run the following command:

mysql -V
mysql  Ver 15.1 Distrib 5.5.56-MariaDB, for Linux (x86_64) using readline 5.1

Upgrade MariaDB from 5.5.x version to 10.2.x version

Before starting with the upgrade procedure, create a backup of your MariaDB databases:

mysqldump -uroot -p --all-databases > /opt/database-dump.sql

Stop the MariaDB service with the following command:

systemctl stop mariadb

Remove MariaDB 5.5.x packages:

yum remove mariadb mariadb-server mariadb-libs

Add a new MariaDB repository:

vi /etc/yum.repos.d/mariadb.repo
name = MariaDB
baseurl =

Clean the repository cache on your server with:

yum clean all

Install MariaDB 10.2

Install MariaDB 10.2.x version using the following command:

yum install MariaDB-client MariaDB-server

Please note, you need to install Postfix and php-mysql packages if you used them prior this upgrade, so run:

yum install postfix php-mysql

Upgrade MariaDB to Current

yum update

Enable MariaDB service to automatically start on server boot:

systemctl enable mariadb

Start the MariaDB service:

systemctl start mariadb

Run the mysql_upgrade command-line command to examine all tables in all MariaDB databases for incompatibilities with the currently installed version of the MariaDB server:


If everything is OK, check the currently installed MariaDB version with:

mysql -V

mysql  Ver 15.1 Distrib 10.2.9-MariaDB, for Linux (x86_64) using readline 5.1

Set the MariaDB root user password and secure MariaDB

There is no MariaDB root user password set by default. Use the following command to set a new MariaDB root user password, remove the anonymous users, secure MariaDB by restricting the remote login for root user and remove the test database.


That is it. MariaDB has been successfully installed on your server.

If you use one of our Linux Host Support  services, you  can simply ask our expert Linux admins to upgrade MariaDB on your CentOS 7 server for you. They are available 24×7and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

This post is copied from: with minor edits to suite my servers 3/11/2020.