Databases

How To Upgrade MariaDB 5.5 to 10.4 on CentOS

In this article, we will provide you instructions of upgrade MariaDB 5.5 to 10.4 on CentOS

Before performing upgradation, we are strongly recommended you take a snapshot(full backup) of the server and perform MariaDB upgrade at your own risk.

Connect to the server via SSH with root user.

1. For security reasons, create a database dump of all database:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --all-databases --routines --triggers > /tmp/all-databases.sql

2. Stop MariaDB service:

# systemctl stop mariadb.service

3. Remove additional packages like mariadb-bench (If any):

# rpm -e --nodeps mariadb-bench

4. Always keep a backup of the database directory in a separate folder:

# cp -v -a /var/lib/mysql/ /var/lib/mysql_backup

5. Create a MariaDB repository.

Open the Setting MariaDB repositories page, choose a distro, release and version of the MariaDB you wish to install.

In this article, we are using MariaDB 10.4

Create the MariaDB.repo file in you favourite editor:

# vi /etc/yum.repos.d/MariaDB.repo

And add following lines:

# MariaDB 10.4 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb] name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

6. Now, start the upgrade of MariaDB

# yum install MariaDB-client MariaDB-server

After it’s finished, start MariaDB:

# systemctl restart mariadb.service

# systemctl enable mariadb.service

7. Upgrade MySQL databases:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

8. Restart MariaDB service:

# systemctl restart mariadb.service

If you are getting conflicts between mysql init script and MariaDB, following command will resolve it.

# systemctl stop mysql; killall mysqld # to stop the incorrect service if it is started

# rm /etc/init.d/mysql && systemctl daemon-reload # to remove the incorrect service script and reload systemctl configuration

# systemctl start mariadb.service # to start MariaDB if not started

That’s it.

In this article, we have seen how our support engineers upgrade MariaDB 5.5 to 10.4 on CentOS.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles