Language & currency
Currency

Free Website & Server Migration

Colonel Server
MariaDB Upgrade - Update MariaDB on AlmaLinux

Why Keeping MariaDB Updated Matters

MariaDB is one of the most widely used open-source relational database management systems. Created by the original MySQL developers, it has become the default database platform for many Linux distributions and hosting environments.

Regular MariaDB upgrades are important for maintaining:

  • Security
  • Stability
  • Performance
  • Compatibility
  • Access to new features

Each release typically introduces improvements to query optimization, replication, storage engines, security mechanisms, and database administration tools.

Running outdated database software can expose systems to known vulnerabilities and may eventually create compatibility issues with modern applications and frameworks.

Before Upgrading MariaDB

Database upgrades should always be planned carefully. Although MariaDB upgrades are generally straightforward, preparation helps minimize downtime and reduces the risk of data loss.

Before proceeding, verify the following:

Wordpress Hosting

WordPress Web Hosting

Starting From $3.99/Monthly

Buy Now

Operating System

This guide applies to:

  • AlmaLinux 8

Required Access

You should have:

  • Root access
  • Sudo privileges
  • Terminal access
  • Internet connectivity

Existing MariaDB Installation

A currently installed MariaDB version must already exist on the server.

Step 1: Check Current Versions

Before making any changes, determine both the operating system version and the installed MariaDB version.

Check the MariaDB version:

mysql -V

Check the AlmaLinux version:

Cheap VPS

Cheap VPS Server

Starting From $2.99/Monthly

Buy Now
cat /etc/redhat-release

Example output:

mysql  Ver 15.1 Distrib 10.5.21-MariaDB

AlmaLinux release 8.8 (Sapphire Caracal)

This information helps verify the current environment and confirms the starting point for the upgrade process.

Step 2: Create Full Backups

Never perform a database upgrade without first creating backups.

A complete backup should include:

  • All databases
  • Database files
  • Configuration files

Export All Databases

Create a full database dump:

mysqldump --all-databases > /tmp/all-database-backup.sql

This generates a SQL backup that can be restored if necessary.

Windows VPS

Windows VPS Hosting

Remote Access & Full Admin

Buy Now

Back Up Database Files

Create a copy of the MariaDB data directory:

cp -a /var/lib/mysql /var/lib/mysql_oldbackup

Back Up Configuration Files

Backup the primary configuration file:

cp -a /etc/my.cnf /etc/my.cnf_oldbackup

If your system contains additional configuration directories, back them up as well.

For example:

cp -a /etc/my.cnf.d /etc/my.cnf.d_oldbackup

These backups provide a recovery path if unexpected issues occur during the upgrade.

Step 3: Stop MariaDB

Before modifying repositories or packages, stop the database service.

systemctl stop mariadb

Verify the service status:

systemctl status mariadb

The service should show as inactive before continuing.

Step 4: Remove the Existing MariaDB Repository

Older MariaDB repositories should be removed or archived before installing a newer release.

Rename the current repository file:

mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb.repo_oldbackup

This preserves the original configuration while preventing conflicts.

Step 5: Update the System

Update all installed packages before proceeding with the database upgrade.

dnf update -y

This ensures repository metadata and system packages are current.

Step 6: Configure the New MariaDB Repository

Create a new repository file:

vi /etc/yum.repos.d/mariadb.repo

Add the appropriate repository configuration.

Example:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.10/rhel8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Replace the version number with the release you intend to install.

Saving this file allows AlmaLinux to retrieve the new MariaDB packages.

Step 7: Remove the Existing MariaDB Server Package

Uninstall the current MariaDB server package.

dnf remove MariaDB-server -y

Clean package metadata afterward:

dnf clean all

This ensures package information is refreshed before installation.

Step 8: Install the New MariaDB Version

Install the updated MariaDB server package.

dnf install MariaDB-server -y

The package manager will download:

  • MariaDB Server
  • Required dependencies
  • Supporting libraries

Depending on the target version, additional packages may also be installed automatically.

Step 9: Install Common MariaDB Components

Many production environments require additional MariaDB packages.

Install commonly used components:

dnf install galera-4 MariaDB-client MariaDB-common MariaDB-shared MariaDB-backup -y

These packages provide:

  • Client utilities
  • Backup tools
  • Replication components
  • Shared libraries

Step 10: Start MariaDB

Start the database service:

systemctl start mariadb

Verify that it is running correctly:

systemctl status mariadb

The service should report an active state.

Step 11: Enable Automatic Startup

Configure MariaDB to start automatically during system boot.

systemctl enable mariadb

This ensures the database service starts after server reboots.

Step 12: Upgrade Internal Database Structures

After installing the new version, internal system tables and metadata may need updating.

Run the upgrade utility:

mysql_upgrade

The upgrade process typically performs tasks such as:

  • Updating system tables
  • Checking database consistency
  • Updating privilege tables
  • Verifying storage engines
  • Fixing compatibility issues

A successful upgrade will complete all phases without errors.

Step 13: Verify the Upgrade

Confirm the installed MariaDB version.

mysql -V

Example:

mysql  Ver 15.1 Distrib 10.10.5-MariaDB

Verify that the reported version matches the intended upgrade target.

Securing MariaDB After Installation

After upgrading, it is a good practice to review security settings.

MariaDB includes a security configuration utility.

Run:

mysql_secure_installation

The wizard allows administrators to:

  • Set or change the root password
  • Remove anonymous accounts
  • Disable remote root access
  • Remove test databases
  • Reload privilege tables

Following these recommendations helps improve database security.

Common Post-Upgrade Checks

After upgrading MariaDB, verify that all applications continue to function correctly.

Recommended checks include:

Test Application Connectivity

Verify that websites and applications can still connect successfully to the database.

Review Database Logs

Check for warnings or errors:

journalctl -u mariadb

or

tail -f /var/log/mariadb/mariadb.log

Log locations may vary depending on the server configuration.

Verify Replication

If replication is configured, confirm that replication processes remain operational.

Check Database Integrity

Review important databases and perform application-level testing before returning systems to production workloads.

Upgrade Best Practices

Always Create Backups

Database upgrades should never be performed without verified backups.

Review Release Notes

Read release documentation before upgrading across major versions.

Test in Staging First

Production environments should ideally test upgrades on staging servers before deployment.

Upgrade Regularly

Smaller, incremental upgrades are generally safer than skipping multiple major releases.

Monitor After Completion

Observe server behavior, application performance, and logs for several days after the upgrade.

Maintaining a Healthy MariaDB Environment

Keeping MariaDB current ensures access to security updates, performance improvements, and modern database features. By following a structured upgrade process that includes backups, repository updates, package installation, database upgrades, and post-upgrade validation, administrators can safely maintain MariaDB environments on AlmaLinux while minimizing downtime and operational risk.

Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *