A simple guide for Linux Ubuntu update Mysql and MariaDB with Plesk from terminal by backing up databases
MariaDB 10.4 and later versions are supported only from Plesk Obsidian 18.0.30. Earlier versions (Onyx and earlier) do not support MariaDB as of 10.3 and there are no plans to implement it currently
Direct upgrade from MySQL 5.1 to MySQL 5.6/5.7 will destroy the table structure. Instructions for upgrading MySQL from 5.1 to 5.5 on Linux are available here.
Direct upgrade from MariaDB 5.5 or 5.7 to MariaDB 10.6 or later is not possible. You have to update MariaDB 5.5 first. or 5.7 to any MariaDB 10.3 to 10.5, then upgrade to MariaDB 10.6 or later.
Backup all databases
As a first step, before upgrading Mysql and MariaDB with Plesk on Ubuntu Linux, make a backup copy of all databases on the server to avoid any data loss and have the ability to roll back:
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --verbose --all-databases --routines --triggers > /tmp/all-databases.sql
Upgrade MariaDB 10.1 to MariaDB 10.x
Stop the MariaDB service
service mariadb stop
Install the new libraries, in this example we will upgrade to MariaDB 10.6
apt-get install software-properties-common apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.6
It is possible to install any of the new versions of MariaDB that you can find here by replacing 10.6 with the desired version in the previous curl.
Backup Mysql
cp -v -a /var/lib/mysql/ /var/lib/mysql_backup
Update Mysql and MariaDB with Plesk
apt-get update apt-get install mariadb-server
Start the MariaDB service
systemctl start mariadb
Update Mysql databases
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin
Restart Mysql service
systemctl restart mariadb
Update version packages in Plesk
plesk bin service_node --update local plesk sbin packagemng -sdf
If everything worked and your databases are working properly delete old backups
rm -R /var/lib/mysql_backup rm /tmp/all-databases.sql