Reading Time: 5 minutes

MariaDB is a well-known, open-source relational database. The same developers involved with MySQL created MariaDB and promised to keep it open source. It is included in most cloud services and is the default in most Linux variants. It is built on performance, stability, and openness principles,. Furthermore, the MariaDB Foundation guarantees that contributions will be accepted based on technical merit. Your consistent upgrading of MariaDB versions to stay current will ensure you are using the best features in the database platform.

Numerous features and improvements have been made with every MariaDB release. To receive essential security updates, and to avoid compatibility issues with other applications, you must upgrade MariaDB to the more recent supported versions. If you keep MariaDB up to date, you will gain several benefits, such as improved performance, increased security, new features, and much more.

Prerequisites Prior to MariaDB Upgrqades

Upgrade MariaDB on AlmaLinux

Step #1: Check the MariaDB and AlmaLinux Versions

You can check the current version of MariaDB and AlmaLinux by executing the following commands:

  • ~]# mysql -V
  • ~]# cat /etc/redhat-release

Here is the output:

[root@nouf ~]# mysql -V
mysql  Ver 15.1 Distrib 10.5.21-MariaDB, for Linux (x86_64) using readline 5.1
[root@nouf ~]# cat /etc/redhat-release 
AlmaLinux release 8.8 (Sapphire Caracal)

Step #2: Back Up the Database

Before performing a MariaDB upgrade, creating a backup or dump of the existing databases and database configuration file is essential.

To dump the database, use the following command:

  • ~]# mysqldump --all-databases > /tmp/all-database-backup.sql

To copy the database directory into a different folder, use the following command:

  • ~]# cp -a /var/lib/mysql /var/lib/mysql_oldbackup

To back up the configuration file, use the following command:

  • ~]# cp -a /etc/my.cnf /etc/my.cnf_oldbackup

Note that the contents of /etc/my.cnf.d/ also need to be backed up if the file exists. Liquid Web Core Managed AlmaLinux 8 servers contain this file.

Step #3: Uninstall the Current MariaDB Repository

Before installing the newest version, uninstall the older MariaDB repositories. You can use the following command to stop the MariaDB service:

  • ~]# systemctl stop mariadb

To confirm MariaDB’s current status, use the following command:

  • ~]# systemctl status mariadb

To rename or move the current repo file, use the following command:

  • ~]# mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo_oldbackup

Step #4: Add the New MariaDB Repository ("Repo")

Before creating a new MariaDB repository, you must update all the packages. You can use the following command to update all the packages:

  • ~]# sudo dnf update -y

You can now create a new repo file for the latest MariaDB version:

  • ~]# vi /etc/yum.repos.d/mariadb.repo

Then, add the following details to the /etc/yum.repos.d/mariadb.repo file and save the file:

name = MariaDB
baseurl =

Step #5: Uninstall the Old MariaDB Version

You can uninstall the old version of MariaDB using the following command:

  • ~]# sudo dnf remove MariaDB-server -y

To clean the repository cache on your server, use the following command:

  • ~]# sudo dnf clean all

Step #6: Install the Latest MariaDB Version

Now, you are ready to upgrade MariaDB. To install the latest MariaDB version, use the following command:

  • ~]# sudo dnf install MariaDB-server -y

Here is the output:

[root@nouf ~]# sudo dnf install MariaDB-server -y
AlmaLinux 8 - BaseOS                                                                                                                     6.0 MB/s | 4.0 MB     00:00    
AlmaLinux 8 - AppStream                                                                                                                   16 MB/s |  11 MB     00:00    
AlmaLinux 8 - Extras                                                                                                                      32 kB/s |  18 kB     00:00    
MariaDB                                                                                                                                  1.0 MB/s | 620 kB     00:00    
Dependencies resolved.
 Package                                          Architecture                      Version                                   Repository                            Size
 MariaDB-server                                   x86_64                            10.10.5-1.el8                             mariadb                               27 M


  MariaDB-server-10.10.5-1.el8.x86_64  boost-program-options-1.66.0-13.el8.x86_64  galera-4-26.4.14-1.el8.x86_64  libpmem-1.6.1-1.el8.x86_64  lsof-4.93.2-1.el8.x86_64 


To install the most common MariaDB packages, as part of the overall MariaDB upgrade, use the following command:

  • ~]# sudo dnf install galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common -y

Step #7: Start MariaDB

To start the MariaDB service, use the following command:

  • ~]# sudo systemctl start mariadb

Step #8: Set MariaDB to Start at Boot Time

To set MariaDB to start at boot time, use the following command:

  • ~]# sudo systemctl enable mariadb

Here is the output:

[root@nouf ~]# sudo systemctl enable mariadb 
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mariadb.service.

Step #9: Upgrade MariaDB

To upgrade MariaDB, use the following command:

  • ~]# mysql_upgrade

Here is the output:

[root@nouf ~]# mysql_upgrade 
Major version upgrade detected from 10.5.21-MariaDB to 10.10.5-MariaDB. Check required!
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK                                         OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
mysql.user                                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
Phase 7/7: Running 'FLUSH PRIVILEGES'

Step #10: Check the Current MariaDB Version

Use the following command to check and verify the currently installed MariaDB version:

  • ~]# mysql -V

Here is the output:

[root@nouf ~]# mysql -V
mysql  Ver 15.1 Distrib 10.10.5-MariaDB, for Linux (x86_64) using readline 5.1
[root@nouf ~]# 

Congratulation on completing a successful MariaDB upgrade!

Secure the MariaDB Database

The most recent version of MariaDB has been set up on AlmaLinux 8. You can now secure the MariaDB Database by using the following command:

  • ~]# sudo mysql_secure_installation

Here is the output:

[root@nouf ~]# sudo mysql_secure_installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

If you want to switch from MySQL to MariaDB, learn more about the key differences between MySQL and MariaDB in our knowledge base and blog online resources. Once you are running MariaDB, you will need to perform MariaDB upgrades from time to time in order to benefit from the newer functionality.


You should now understand how to upgrade MariaDB on AlmaLinux. How to make a backup, uninstall the previous version, and secure MariaDB after upgrading it, was also covered. MariaDB is an excellent alternative to MySQL for database hosting.

Liquid Web can help you upgrade MariaDB on managed Linux servers. Our Dedicated Servers are simply one of several alternatives. Feel free to contact us if you need further assistance configuring your web hosting configuration and servers.

Avatar for Mohammed Noufal

About the Author: Mohammed Noufal

Mohammed Noufal is a B.Tech graduate with a decade of experience in server administration and web hosting. He is a father to two daughters and finds fulfillment in their growth. In his free time, he enjoys blogging, sharing experiences, and listening to music. With a strong technical background, family commitment, and creative outlets, he represents a well-rounded life journey.

Latest Articles

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article