Upgrade to MariaDB 10.4 VestaCP Debian 9

Out the box MariaDB on Debian 9 was 10.1 on my VestaCP server. This wasn’t high enough to run some of the web apps I needed, so I did the following to upgrade (based on MariaDB’s recommended process for upgrading). This guide will show you how to easily upgrade your MariaDB database server if you’re running Debian 9 and VestaCP.

Preparation for Upgrade

Add the official MariaDB apt repo to your server as root:

apt install software-properties-common dirmngr
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.one.com/mariadb/repo/10.4/debian stretch main'

Now update your available packages list

sudo apt-get update

Before starting I backed up my mysql/mariadb config (just in case)

cp /etc/mysql/my.cnf /etc/mysql/bak.my.cnf

Performing the upgrade

Stop MariaDB from running.

systemctl stop mariadb

Now run the following command. This will firstly remove the previous mariadb-server-10.1 and mariadb-client-10.1 packages and then install the 10.4 versions

apt install mariadb-server-10.4 mariadb-client-10.4

Now start MariaDB

systemctl start mariadb

Check that you now have 10.4 running

systemctl status mariadb

Lastly run mysql_upgrade. This ensures that the tables in your databases are compatible with the new version and then marks them as so.

mysql_upgrade

That is all I did and I’m now running on Mariadb 10.4 with no issues. Hope this of help to other VestaCP users on Debian.