Converting from MySQL to MariaDB on Ubuntu

This guide will describe the steps for converting a MySQL server to a MariaDB server and resolving unsatisfied dependencies that may arise during the conversion process. This manual is intended only for virtual servers on which the Ubuntu operating system is installed.

Uninstall MySQL server

To get started, run these commands as root or use sudo


service mysql stop
apt-get remove mysql-server mysql-common libmysqlclient18

Install MariaDB

Run the following command

apt-get install software-properties-common

Add MariaDB Store Key

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db

Add MariaDB Repository

sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.0/ubuntu trusty main'

Install MariaDB

apt-get install mariadb-server libmariadbclient18

Handling Unsatisfied Dependencies

The MariaDB installer may fail (which often happens) with an error, such as this one:

mariadb-server : Depends: mariadb-server-10.0 (specific version) but it is not going to be installed.

This can be frustrating and may not look right. Next, you need to install all the adjacent dependencies. Add g ++ repository to server to resolve libstdc ++ 6 dependency.

Add g ++

add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install g++-4.9

Pin the MariaDB repository

This is done by creating a file with MariaDB.pref in /etc/apt/preferences.d/ with the contents shown below:

Package: *
Pin: origin <mirror-domain>
Pin-Priority: 1000

Replace the <mirror-domain> that is displayed when accessing the MarizDB repository selection page

In my case, I chose the “University of Dallas”. After updating, the file now has the following contents:

Package: *
Pin: origin http://ftp.udallas.edu/mariadb/repo/10.0/ubuntu
Pin-Priority: 1000

Save the file, upgrade your system.

apt-get update

Now, dependency problems have been resolved. If you use 12.04, then pay attention to the fact (it is important) that there were reports that g ++ was excluded from this version.

Install MariaDB again

apt-get install mariadb-server

Check your installation of MariaDB

service mysql start
mysql -u root -p

Now, you can see the following (or the same) output

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is XXXX
Server version: 10.0.X


Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

Was this article helpful?

Related Articles