How do I upgrade from MariaDB 5.5 to 10.1 on CentOS7

November 5, 2015 1.4k views
MariaDB LAMP Stack CentOS

I set up a CentOS7 LAMP server a couple of months ago, and installed MariaDB with sudo yum install mariadb-server mariadb. It seemed to default to MariaDB 5.5. But I'd like to upgrade to 10.1 - unless anyone thinks there is any reason this is not a good idea?

What is the easiest and safest way to do this?


1 Answer

Hey there,

It's fairly painless. Prior to doing anything I'd recommend exporting your databases as backups and if this is a DigitalOcean Droplet, I'd recommend creating a snapshot.

Here is the readout from my current Droplet which is similar to your example:

# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 
# mysql -v
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server

I'm going to remove MariaDB with this command:

yum remove mariadb mariadb-server

Create /etc/yum.repos.d/MariaDB.repo and place the following contents into it:

# MariaDB 10.1 RedHat repository list - created 2016-02-06 03:30 UTC
name = MariaDB
baseurl =

Reinstall MariaDB with this command:

yum install mariadb mariadb-server

(Accept the importing of the RPM-GPG-KEY-MariaDB key with a "Y")

You'll want to start MariaDB and make sure it's enabled to start on boot:

systemctl start mariadb
systemctl enable mariadb.service

IMPORTANT: You can then run mysql_upgrade to update the databases to the new MariaDB version.

And the upgrade is now complete:

# mysql -v
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.1.11-MariaDB MariaDB Server

Happy coding,

Jon Schwenn
Platform Support Specialist

by Etel Sverdlov
MySQL is a powerful database management system used for organizing and retrieving data. This tutorial explains how to import and export MySQL databases and how to reset a root MySQL password
Have another answer? Share your knowledge.