For this post we are going to migrate mysql to mariadb.

Here’s a little background:
MariaDB is created by the original creators of MySQL, it contains a lot of major bug fixes which still exists in MySQL and is therefore more reliable than MySQL

For this tutorial we assume you have mysql installed on your linux machine.

Let’s start by backing up your existing databases in case something goes wrong.
If you have one database, run the following:

mysqldump -u MYSQLUSERNAME -p database_name > /location/database_name.sql

If you want to backup multiple databases you can run the following:

mysqldump -r MYSQLUSERNAME -p --databases database_one database_two > /location/two_databases.sql

And if you think you need to backup all mysql tables and all things that come with it, you can also run this command:

mysqldump -u MYSQLUSERNAME -p --all-databases > /location/all_databases.sql

You will be prompt for a password. If you have a password set, fill it in, if not, just press enter.

Now we will install mariadb.
We can simply install it over our existing mysql data.
Go to this link: https://downloads.mariadb.org/mariadb/repositories/

Here you will select your linux distribution, in my case I am selecting Ubuntu.
On the second box we will select our version, I will select 14.04 “Trusty”.
In the third box we will select version 10.1
in the last box you can select your preferred mirror, any will do.

When you selected everything, a little bit of information will pop up.
in my case I got the following:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirror.i3d.net/pub/mariadb/repo/10.1/ubuntu trusty main'

When you’ve ran the commands, we will start installing mariadb.
First run:

sudo apt-get update

Then run:

sudo apt-get install mariadb-server

When everything goes right, you will get the same output as installing mysql. (Like prompting for password etc)

No run:

mysql -u MARIADBUSERNAME -p

Fill in a password if you have any, and then run:

SHOW DATABASES;

If you get a list with your databases still existing, you’re lucky.
If you don’t get a list with your databases in there, run the following:

mysql -u MARIADBUSERNAME -p database_name < /location/database_name.sql

This will import your backedup databases into the existing mariadb server.

I hope it all worked out for you.
Thanks for reading, and good luck with MariaDB!