Upgrading or Updating MariaDB on AlmaLinux 9
What
Use this procedure to move an AlmaLinux 9 server to a newer MariaDB release from the MariaDB repository. Plan downtime and take backups first.
When/Why
Use this when you need a newer MariaDB release for fixes, security updates, or feature changes that are not available in the currently installed packages.
How
1. Check the current MariaDB and AlmaLinux versions
Confirm the current MariaDB version and the AlmaLinux release:
mysql -V
cat /etc/almalinux-release
2. Back up the databases and MariaDB configuration
Back up the databases before 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. Stop MariaDB and move the old repository file out of the way
Stop MariaDB 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. Create the new MariaDB repository file
Create or update /etc/yum.repos.d/MariaDB.repo for the major release you want to install. Example for MariaDB 10.11:
[mariadb]
name = MariaDB
baseurl = https://yum.mariadb.org/10.11/rhel9-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
5. Remove the old MariaDB server package
Remove the current MariaDB server package and clean the metadata cache:
dnf remove mariadb-server
dnf clean all
6. Install the new MariaDB packages and run the upgrade step
Install the MariaDB packages from the new repository, then start and enable the service:
dnf install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common
systemctl start mariadb
systemctl enable mariadb
mariadb-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 the installed MariaDB version and service status:
mysql -V
systemctl status mariadb
Related Links
- MariaDB yum/dnf installation and upgrade docs: https://mariadb.com/docs/server/server-management/install-and-upgrade-mariadb/installing-mariadb/binary-packages/rpm/yum
- mariadb-upgrade reference: https://mariadb.com/docs/server/clients-and-utilities/deployment-tools/mariadb-upgrade
- AlmaLinux wiki: https://wiki.almalinux.org/
No comments to display
No comments to display