Question

How do I upgrade from MariaDB 5.5 to 10.1 on CentOS7

Posted November 5, 2015 15.7k views
CentOSLAMP StackMariaDB

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?

Thanks

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Thank you. Beautiful, simple, very helpful guide.

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
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

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
DigitalOcean

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
Submit an Answer