You shouldn’t do it at all. But if, here are the steps… Pay attention at every step and don’t do without a current backup!
All steps assume you’re logged in as root. Otherwise, prefix with sudo.
Perform database backup:
mysqldump -u [username] -p[password] [database_name] > backup.sql
Stop MariaDB server:
systemctl stop mariadb
Find the to be installed version number on mariadb.org and pop it in at the end (e. g. 11.2.3):
apt 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=11.2.3
Backup MySQL data:
cp -v -a /var/lib/mysql/ /var/lib/mysql_backup
Perform upgrade:
apt-get update;apt-get install mariadb-server
Modify my.cnf:
sed -i 's/bind-address = ::ffff:127.0.0.1/bind-address = 127.0.0.1/g' /etc/mysql/my.cnf
Start MariaDB service:
service mariadb start
Update MySQL/MariaDB databases:
mariadb-upgrade
Restart MySQL service:
service mariadb restart