Upgrading MariaDB LTS
Why upgrade
When you install CloudPanel, it will install the MariaDB version you selected for the installation at this time.
There are a few reasons why you might want to upgrade:
- The version of MariaDB is no longer suppored. It was possible in the past to install non-LTS versions of MariaDB when installing CloudPanel. These versions are since deprecated and their repos have been removed. You will know if this is the case when apt update shows you errors about not finding the mariadb apt repos.
- There is a new LTS available. MariaDB releases a new LTS version about every year. If you want to make use of the new features or stability improvements then you should update to the latest LTS
Before you upgrade
You should make a backup of your server or databases first. It is unlikely that the upgrade will fail but better have a backup just in case.
In some steps you might be asked for your root password. You can get your root credentials using clpctl db:show:master-credentials.
Check with the maria db documentation to see what changes might have an impact on your applications. There are some guides here: https://mariadb.com/kb/en/upgrading/
How to upgrade
Here is a quick guide on how to upgrade MariaDB latest 11.8 LTS release. Adapt the steps based on your installed and target mariadb version.
- Stop the service with
systemctl stop mysql - Removed the old mariadb with
apt remove mariadb-server - Change the file
/etc/apt/sources.list.d/mariadb.listfrom your current version (e.g.11.4) to the target version11.8
For example:deb [arch=amd64,arm64] https://mirror.mariadb.org/repo/11.8/ubuntu noble main - Run
apt update - Install mariadb 11.8 with
apt install mariadb-server. This also upgradesmariadb-commonand removes old mariadb 10.11 packages still existing after the mariadb-server uninstall.
⚠️ If asked about the file50-server.cnfanswernto not create that file - Start the service with
systemctl start mysql - Run the upgrade command with
mariadb-upgrade -u root -p -h 127.0.0.1. Here you will need your root password obtained from theclpctl db:show:master-credentialscommand. - Run
sqlite3 /home/clp/htdocs/app/data/db.sq3 "UPDATE database_server SET version='11.8' WHERE engine = 'MariaDB' AND host='127.0.0.1'"to update the CloudPanel UI to reflect your new version in the database servers list.