Updating MariaDB on Ubuntu
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 MariaDB versions 10.X to MariaDB 11.4, and only in the default configuration on Ubuntu 22.04 and 24.04.
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 MariaDB 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 upgrade, the dashboard, websites, and applications that use this database server will be unavailable. Choose a time with minimal server load for the upgrade, 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:
apt -y update; apt upgrade
Disable monitoring of the mariadb 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 command, 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
Install the packages required for the update:
apt install curl apt-transport-https
Add the MariaDB repository version 11.4:
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-11.4"
Stop the MariaDB service:
systemctl stop mariadb
Update the DBMS packages:
apt update; apt install --only-upgrade mariadb-server mariadb-client libmariadb3 mariadb-common mysql-common
During the update, you will be asked whether to overwrite the configuration file /etc/mysql/mariadb.conf.d/50-server.cnf. We recommend answering «keep your currently installed version» to preserve the current configuration.
Start and verification
Check the MariaDB service status:
systemctl status mariadb
If the service returns an error, check the syntax of the configuration file:
/usr/sbin/mariadbd --defaults-file=/etc/mysql/my.cnf --verbose --help | grep 'ERROR\]'
If necessary, correct the errors, then start the service and enable its autostart:
systemctl start mariadb
If the service fails to start, make sure 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, run the following command:
tail -n 50 /var/log/mysql/error.log
Contact ispmanager support team for assistance with database server errors.
If there are no errors, update the database structure:
mariadb-upgrade
Remove symbolic links:
rm /lib/systemd/system/mysqld.service /lib/systemd/system/mysql.service /usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/mysql.service -f; systemctl daemon-reload
Enable autostart for the service:
systemctl enable mariadb
Check the MariaDB version:
dpkg -l | grep -iE "(mysql|mariadb)" | grep -i server
Check DBMS authorization:
mariadb -u root -p
Replace the path to the service executable:
sed -i "s/\/usr\/sbin\/mysqld/\/usr\/sbin\/mariadbd/g" /usr/local/mgr5/etc/ispmgr.conf.d/mysql.conf
Start the panel:
/usr/local/mgr5/sbin/mgrctl -m core --unlock
Go to the Notifications section and delete any notifications about resolving the mariadb 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.
- Re-enable service monitoring in the panel