Skip to main content

Upgrading or Updating MariaDB on AlmaLinux 9

What

ThisUse articlethis providesprocedure to move an AlmaLinux 9 server to a step-by-step guide to upgrading or updatingnewer MariaDB onrelease AlmaLinuxfrom 9.the MariaDB isrepository. aPlan popular open-source database management system. Updating to the latest version will ensure optimal performance, security,downtime and compatibility.take backups first.

When/Why

UpdatingUse or upgrading MariaDB on AlmaLinux 9 should be performedthis when you need a newer versionMariaDB isrelease available,for tofixes, improvesecurity database operations, add new features,updates, or patchfeature potentialchanges vulnerabilities.that are not available in the currently installed packages.

How

1. Check Currentthe current MariaDB Version onand AlmaLinux 9versions

CheckConfirm the current MariaDB version and the AlmaLinux OS version using the following commands:release:

mysql -V
cat /etc/almalinux-release

2. CreateBack aup Backupthe ofdatabases Existingand MariaDB Databasesconfiguration

CreateBack aup backupthe ofdatabases existingbefore databases:changing packages or repositories:

mysqldump -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

3. Uninstall OldStop MariaDB Repositories

and

Uninstallmove the old repository file out of the way

Stop MariaDB repositories:and move the existing repository definition aside:

systemctl stop mariadb
mv /etc/yum.repos.d/mariadb.repo /etc/yum.repos.d/mariadb_bk
dnf update

4. AddCreate the new MariaDB Repositoryrepository on AlmaLinux 9file

Create aor newupdate repo file for the latest version:

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

Pastefor the followingmajor contentsrelease intoyou thewant file:to install. Example for MariaDB 10.11:

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

5. Remove Oldthe old MariaDB Serverserver package

Remove the oldcurrent MariaDB version:server package and clean the metadata cache:

dnf remove mariadb-server
dnf clean all

6. UpgradeInstall the new MariaDB packages and Installrun Latestthe MariaDBupgrade step

Install the latest version of MariaDB onpackages yourfrom server:the new repository, then start and enable the service:

dnf install MariaDB-server
dnf install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
systemctl start mariadb
systemctl enable mariadb
mysql_upgrademariadb-upgrade -u root -p

On MariaDB 10.5 and later, mariadb-upgrade is the current command. mysql_upgrade may still exist as a compatibility alias.

Verify yourthe installed MariaDB version and service status:

mysql -V
systemctl status mariadb
mariadb-upgrade reference: https://mariadb.com/docs/server/clients-and-utilities/deployment-tools/mariadb-upgrade AlmaLinux OS Documentation:wiki: https://wiki.almalinux.org/documentation.html