Menu

Upgrade MySQL MariaDB To New Stable Version on Linux Server

Upgrading your MySQL MariaDB to the stable version is essential to ensure the security, performance, and compatibility of your database.

In this guide, we’ll walk you through the steps to upgrade MariaDB on a Linux server, specifically focusing on upgrading from version 10.4 to the newer and more stable MariaDB version. This version introduces several new features and improvements that enhance the overall functionality of the database system.

Why Upgrade MySQL MariaDB?

Upgrading MariaDB to stable release that brings a host of new features, bug fixes, and performance improvements. Some of the key enhancements in this version include better performance for large datasets, improved query optimization, and enhanced security features.

For a complete list of changes, you can check the official MariaDB Release Notes.

Before proceeding with the upgrade, it’s important to verify that your current applications are compatible with MariaDB 10.6. In our case, we had MariaDB 10.4 (which is out dated now in 2024).

Instead of upgrading to the latest MariaDB 11.6 (released on August 14, 2024), we plan to upgrade to MariaDB 10.6. It’s a best practice to move from MariaDB 10.4 to 10.6 to ensure that our applications continue to run smoothly without any issues.

We have tested MariaDB 10.6 with several popular PHP scripts like new version of WordPress 6.6, Joomla, XenForo, and IPS Forum. All of these platforms are functioning correctly with MariaDB 10.6, making it a safe and beneficial upgrade.

Note: You can install MariaDB 10.11 Series or MariaDB 11.4 Series by following steps below.

Upgrade MariaDB For VestaCP, CWP or CentOS Linux (Alma8, Centos 8)

How To Upgrade MariaDB?

Upgrading MariaDB is a straightforward process that ensures your database stays secure and up-to-date. To upgrade, follow these simple steps to move from your current version to a newer, more stable release.

Step 1: Backup Your Databases

Before making any changes, back up your existing databases to prevent data loss. Use the following command to back up all databases:

mysqldump -u root -p --all-databases > all_databases_backup.sql

First backup your current my.cnf config :

cp /etc/my.cnf /etc/my.cnf.bak

Step 2: Remove Old MariaDB version (Which is 10.4 currently Installed on our server)

In my case I am using the YUM command onLinux Alma 8, but if you are using Ubuntu or Debian you can simply use APT.

Now we need to remove current version of MariaDB

run below commands

service mysql stop 
rpm -e --nodeps galera
yum remove MariaDB-server MariaDB-client

At this point MariaDB 10.5  will be removed completely but the databases are not removed, so you don’t need to worry.

Step 3: Install new MariaDB version

Configure the YUM package repository.

I am using Predefined MariaDB Repository which supports below distributions:

  • RHEL/Rocky 8 & 9 (rhel)
  • RHEL/CentOS 7 (rhel)
  • Ubuntu 20.04 LTS (focal), 22.04 LTS (jammy), and 24.04 LTS (noble)
  • Debian 10 (buster), Debian 11 (bullseye), and Debian 12 (bookworm)
  • SLES 12 & 15 (sles)”

If you have any other platforms follow this link : https://mariadb.com/kb/en/mariadb/mariadb-package-repository-setup-and-usage/#platform-support

Configure the YUM package repository:

Install wget using following command:

sudo yum install wget

Download MariaDB Repo setup file by using following command:

wget https://r.mariadb.com/downloads/mariadb_repo_setup

Verify the integrity of the mariadb_repo_setup file by checking its SHA-256 checksum

echo "6083ef1974d11f49d42ae668fb9d513f7dc2c6276ffa47caed488c4b47268593 mariadb_repo_setup" \
    | sha256sum -c -

Change the permissions of the mariadb_repo_setup file for making it executable:

chmod +x mariadb_repo_setup

Run the following command to set up the MariaDB repository on your system. In my case I am targeting the installation of MariaDB version 10.6.

sudo ./mariadb_repo_setup \
   --mariadb-server-version="mariadb-10.6"

If you wanted to install or upgrade to MariaDB version 11.5 instead of 10.6, you can adjust the command. This flexibility lets you choose the specific version of MariaDB that best suits your needs.

Use Following command to install MariaDB server and client, along with some additional packages,

yum install MariaDB-server MariaDB-client net-snmp perl-DBD-MySQL -y
Upgrade MySQL MariaDB

Optional: You can also run the following command to upgrade other packages

yum update -y

Step 4: Restore the my.cnf file

rm -rf /etc/my.cnf
cp /etc/my.cnf.bak /etc/my.cnf

Step 5: Enable MariaDB to start on boot and start the service:

systemctl enable mariadb

service mysql start

Step 6: Upgrade and Verify MySQL databases

After Installation we need to upgrade MySQL MariaDB current databases by this command:

mysql_upgrade

You can confirm the version by running this command:

mysql
Check mysql version

Reboot the server with the following command:

reboot

Frequently Asked Questions (FAQs)

Why should I upgrade MariaDB?

Upgrading MariaDB to new stable version ensures that you benefit from the latest features, performance improvements, and security patches. Currently MariaDb Version 11.5 is stable and offers enhanced compatibility with various applications, making it a reliable choice for your database needs.

How do I check the current version of MariaDB on my Linux server?

You can check the current version of MariaDB by running the command mysql -V or mariadb –version in the terminal. This will display the installed version of MariaDB.

Is it safe to upgrade to MariaDB 10.6 if I’m using WordPress, Joomla, or other PHP-based applications?

Yes, it is generally safe to upgrade to MariaDB 10.6. In our testing, applications like WordPress, Joomla, XenForo, and IPS Forum have worked smoothly with MariaDB 10.6. However, it’s always a good practice to back up your data before proceeding with an upgrade.

How do I set up the MariaDB repository for version 10.6?

You can set up the MariaDB repository for version 10.6 by running the mariadb_repo_setup script with the –mariadb-server-version=”mariadb-10.6″ option. This configures your system to download and install the specified version of MariaDB.

What should I do if something goes wrong during the upgrade?

If you encounter issues during the upgrade, you can restore your database from the backup you created before starting the process. Additionally, you can check the MariaDB documentation and community forums for troubleshooting tips or seek help from a database administrator.

What are the prerequisites for upgrading MariaDB on Linux?

Before upgrading, ensure you have a full backup of your databases, root or sudo access to the server, and that your applications are compatible with the new MariaDB version. Also, make sure your system meets the minimum requirements for the version you’re upgrading to.

Watch Video

Share Article on: