A simple guide for Linux Ubuntu update Mysql and MariaDB with Plesk from terminal by backing up databases

WARNING. The steps below should be performed by experienced people as they are potentially dangerous and could damage the server. If you do not know what you are doing you can request a free quote.

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

Fonte: https://support.plesk.com/hc/en-us/articles/213403429–How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-x-on-Linux-

Mysql and MariaDB Update Quote

    Contact us for a free quote