In this guide, we want to teach you How To Upgrade MariaDB on Centos 7.
MariaDB is a fork of MySQL. In other words, it is an enhanced, drop-in replacement of MySQL.
A drop-in replacement means you can substitute the standard MySQL server with the analog version of the MariaDB server and take full advantage of the MariaDB improvements without needing to modify your application code.
MariaDB is fast, scalable, and robust. It supports more storage engines than MySQL. MariaDB also includes many plugins and tools that make it versatile for lots of use cases.
For version 10.8 some new features include:
- Lag-free ALTER TABLE in replication.
- Descending indexes.
- Auto-create partition.
How To Upgrade MariaDB on Centos 7
To upgrade your MariaDB service, you need some requirements.
First, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Centos 7.
Then, you must have a version of MariaDB running that is not the latest version.
Now follow the steps below to complete this guide.
Upgrading MariaDB on Centos 7
First, you must check the current MariaDB version and Centos version using the below commands:
# mysql -V
Output mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
Output CentOS Linux release 7.9.2009 (Core)
Then, you must create a backup or a dump of the existing databases. To do this, run the following command:
-u root -p
--all-databases > /tmp/database-backup.sql
cp -a /var/lib/mysql /var/lib/mysql.backup
cp -a /etc/my.cnf /etc/my.cnf_bk
systemctl stop mariadb
systemctl status mariadb
Output ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: inactive (dead) since Wed 2022-06-22 05:41:22 EDT; 8s ago Process: 14541 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 14540 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS) Process: 14506 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS) Main PID: 14540 (code=exited, status=0/SUCCESS)
Move the current MariaDB repository with the following command:
mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb_bk
Copy and paste the following contents into the file:
[mariadb] name = MariaDB baseurl = https://mariadb.mirror.wearetriple.com/yum/10.8/centos7-amd64 gpgkey=https://mariadb.mirror.wearetriple.com/yum/RPM-GPG-KEY-MariaDB gpgcheck=1
When you are done, save and close the file.
Now, you need to remove the MariaDB old version by using the command below on Centos 7:
yum remove mariadb-server
yum clean all
yum install MariaDB-server
To install the latest version of MariaDB and the most common packages, run the following command:
yum install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
systemctl start mariadb
systemctl enable mariadb
mysql_upgrade -u root -p
Output mysql Ver 15.1 Distrib 10.8.3-MariaDB, for Linux (x86_64) using readline 5.1
For more information, you can visit the MariaDB Documentation page.
At this point, you learn to Upgrade MariaDB on Centos 7 step by step.
Hope you enjoy it.