This guide is intended to help you with converting a MySQL server to a MariaDB server. In addition, we will be resolving unmet dependencies that may happen during the conversion process. These steps are written to work for Ubuntu Server.
- A Vultr VPS running any version of Ubuntu. This article uses 14.04, but other versions should work.
- MySQL already installed and running.
- Knowledge of SSH, some Linux commands.
You’ll be running several commands, one after the other before we move on with installing MariaDB.
Run these commands as root or use sudo. This guide assumes that you’re running as root.
service mysql stop apt-get remove mysql-server mysql-common libmysqlclient18
Run the following commands as root or use sudo.
apt-get install software-properties-common
Add the MariaDB repository keys.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
Add the MariaDB repository to your server.
sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.0/ubuntu trusty main'
Finally, install MariaDB.
apt-get install mariadb-server libmariadbclient18
Handling unmet dependencies
The MariaDB installer may fail with an error similar to the following.
mariadb-server : Depends: mariadb-server-10.0 (specific version) but it is not going to be installed.
This can be frustrating. You will need to install all of the dependencies. The most difficult to resolve is “libstdc++6 version 4.9”. We will work around these with the following steps.
- Add g++ repository to the server to resolve libstdc++6 dependency.
- MariaDB repository pinning to prevent dependency issues and conflicts.
Add the g++ repository
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
/etc/apt/preferences.d/ with the following contents:
Package: * Pin: origin <mirror-domain> Pin-Priority: 1000
<mirror-domain> with the mirror shown when accessing the MariaDB Repositories Selection page.
In my case, I chose the “University of Texas”. After updating it, the file now has this content:
Package: * Pin: origin http://ftp.utexas.edu/mariadb/repo/10.0/ubuntu Pin-Priority: 1000
Save the file, update your system.
The dependency issues will now be resolved. If you are running 12.04, note that there have been reports that g++ was excluded on this version.
Install MariaDB again.
apt-get install mariadb-server
Test your Maria DB installation.
service mysql start mysql -u root -p
You’ll see similar output to the following.
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)]>
Congratulations, you’ve successfully migrated from MySQL to MariaDB on Ubuntu!
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article