Skip to main content

How to Upgrade MariaDB 5.5 to MariaDB 10.1 Stable Release on CentOS 7 for VestaCP ?

By Default VestaCP will install old base version of Mariadb 5.5 when installing on Centos 7.

I am using VestaCP with
Version: 0.9.8 (x86_64), Release: 23
5.5.60-MariaDB - MariaDB Server
PHP version: 5.6.40


In this tutorial we are going to show you how to upgrade MariaDB 5.5 to MariaDB 10.1 latest stable version. You will need to have root access to the machine, where you will be performing the upgrade.

Note that if you are running earlier version of MariaDB the recommended course of upgrading is by going through each version. For example MariaDB 5.1 -> 5.5 -> 10.1.
Clean all yum cache & update yum
# yum clean all
# rm -rf /var/cache/yum
# yum update -y
Step 1: Backup or Dump All MariaDB Databases
As always when performing an upgrade creating backup of your existing databases is important. You can either dump the databases with command such:
# mysqldump -u root -pPassbMUs1Pbu --all-databases > /tmp/all-database.sql 
Or alternatively, you can stop the MariaDB service with:
# systemctl stop mariadb 
And copy the databases directory in a separate folder like this:
# cp -a /var/lib/mysql/ /var/lib/mysql.bak 
Step 2: Add the MariaDB Repository
A good practice is to make sure your packages are up to date before making any changes to your repo files. You can do this with:
# yum clean all
# rm -rf /var/cache/yum
# yum update -y
Add MariaDB Repo & Then save and exit the file
# vi /etc/yum.repos.d/MariaDB10.repo 
Add the following text in it: MariaDB Repo Link
# MariaDB 10.1 CentOS repository list - created 2019-04-11 06:04 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1 
Step 3: Remove MariaDB 5.5
To do this, simply run the following command:
# yum remove mariadb-server mariadb   [best choice] 
OR
# yum remove mariadb-server mariadb mariadb-libs  
Next, clean the repository cache:
# yum clean all
# rm -rf /var/cache/yum
# yum update -y
Step 4: Installing MariaDB 10.1
# yum -y install MariaDB-server MariaDB-client 
Once the installation is complete, you can start the MariaDB service with:
# systemctl start mariadb 
# systemctl enable mariadb
Finally run the upgrade command to upgrade MariaDB with:
# mysql_upgrade 
To verify that the upgrade was successful, run the following command:
# mysql -V 
This Article is tested on my production environment and successfully working .
And this article based on:
Link 1
Link 2
Link 3

Comments