/
/
Updating MySQL on AlmaLinux

Updating MySQL on AlmaLinux

Disclaimer

This article is for informational purposes only. The update involves connecting to a third-party repository and updating the DBMS with critical changes. Ispmanager assumes no liability for any database server malfunctions due to incorrect actions, unsupported server configuration, or incorrect packages in this repository.

Before updating, backups of the panel administrator, panel users, and their databases must be configured and successfully created in the panel.

This update only supports from MySQL 8.0 to MySQL 8.4, and only in the default configuration on AlmaLinux 8 and 9.

When updating the DBMS according to these instructions, you must understand all the steps and accept full responsibility! To ensure continued support for the panel and its functionality, we recommend staying on the default DBMS version from the OS vendor.

We also highly recommend that you consult the official MySQL documentation for the specified versions before updating to verify compatibility between directives, their values, and database data parameters.

Do not use any MySQL server mode: the sql-mode directive should be left blank or removed from the DBMS configuration file entirely. This is necessary to ensure compatibility with legacy database data types.

Preparation

During the database server update, the control panel, websites, and applications that use this database server will be unavailable. Choose a time with minimal server load for the update, and notify your users!

Make sure you have at least 2 GB of free disk space plus enough space for a full backup of all databases:

df -h /

Make sure you have at least 2 GB of free RAM:

free -mh

Update all system packages:

dnf update

Disable monitoring of the mysqld service in the Services section of the control panel using the Monitoring button.

Stop the ispmanager 6 control panel:

/usr/local/mgr5/sbin/mgrctl -m core --lock

To verify that the control panel processes have stopped, run the following commmand, the output must be empty:

ps aux | grep -i "bin/core ispmgr" | grep -v grep

Copy the DBMS root password from /root/.my.cnf and create a backup (dump) of all native DBMS databases:

mysqldump -u root -p<password> --all-databases --single-transaction --quick --lock-tables=false > full-backup-$(date +%F).sql

Check for the line "Dump completed" in the dump, it indicates successful dump creation:

tail <dump_name>

A successfully created dump is critical to ensuring the safety of all data in the database, we highly recommend not to proceed with the update if the dump was not created correctly!

If you need to start the panel after stopping it earlier, see the Start and verification section.

Update

Stop the MySQL service:

systemctl stop mysqld

Disable the mariadb and mysql modules from AppStream:

dnf module disable mariadb -y
dnf module disable mysql -y

Connect the MySQL 8.4 repository:

tee /etc/yum.repos.d/mysql-community.repo << EOF
[mysql-8.4-lts-community]
name=MySQL 8.4 LTS Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.4-community/el/\$releasever/\$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql-2025
EOF

The GPG key link may change. Check the current key file directly in the repository.

Clear and rebuild the package cache:

dnf clean all
dnf makecache

Disable the legacy authentication plugin in Almalinux 8:

sed -i 's/^default_authentication_plugin/mysql_native_password=ON\n#default_authentication_plugin/' /etc/my.cnf.d/mysql-default-authentication-plugin.cnf

In MySQL 8.4, the mysql_native_password plugin is still supported for authorization of previously created users, but it cannot be set as the default plugin via the default-authentication-plugin directive.

New users will be created with authentication via caching_sha2_password – this is the security standard.

Change the authentication method for all MySQL users to the effective one, as per the instructions.

Install the new MySQL version packages:

dnf install mysql-community-server mysql-community-client

Start and verification

Check the main configuration file for errors:

mysqld --defaults-file=/etc/my.cnf.d/mysql-server.cnf.rpmsave --validate-config

If there are no errors, restore the configuration file:

cp -ar /etc/my.cnf.d/mysql-server.cnf.rpmsave /etc/my.cnf.d/mysql-server.cnf
echo -e \!includedir /etc/my.cnf.d\\n >> /etc/my.cnf

Enable the legacy authentication plugin:

echo -e mysql_native_password=ON\\n >> /etc/my.cnf.d/mysql-server.cnf

If you are using your own additional configuration files, check, correct, and restore them using the above commands, replacing mysql-server.cnf.rpmsave and mysql-server.cnf with the names of your configurations.

Start and check the status of the MySQL service:

systemctl start mysqld
systemctl status mysqld

If the service fails to start, ensure that the log_error directive is assigned to the log in the configuration file. By default, the log is located at /var/log/mysql/error.log. To see the latest entries, use the command below:

tail -n 50 /var/log/mysql/error.log

Contact ispmanager support team for assistance with database server errors.

Enable autostart for the service:

systemctl enable mysqld

Check the MySQL version:

rpm -qa | grep -iE "(mysql|mariadb)" | grep -i server

Check DBMS authorization:

mysql -u root -p

Start the panel:

/usr/local/mgr5/sbin/mgrctl -m core --unlock

Go to the Notifications section and delete any notifications about resolving the mysql service issue, if any.

In the Software configuration section, the MySQL DBMS server item may be inactive. This is standard panel behavior and is due to manual modification of the native software.

Post-update steps

  • Sites running PHP-FPM may display a 404 error. This is due to the lack of support for user-friendly URLs. You can enable friendly URL support in the settings for each specific site in the Sites section.
  • In AlmaLinux 8, for phpMyAdmin to function correctly, follow the instructions to update the system PHP to version 7.4, as the native version 7.2 does not support the caching_sha2_password plugin, and phpMyAdmin will not be able to authenticate to the new database server.
  • Enable mariadb service monitoring in the Services section of the control panel using the Monitoring button.