Switching the Blog to MariaDB

WordPress, which is the blogging platform used to run this site, relies on PHP and MySQL to operate. A while back, Sun bought MySQL, and then Oracle subsequently bought Sun. Two of the most important pieces of that second acquisition were MySQL, and the Java programming language. Without getting into too much of the debates, many people feel that Oracle isn’t a great steward for either Java or MySQL. To that end, the original creator of MySQL forked the code and created an alternative called MariaDB. MariaDB aims to be a seamless drop in replacement for MySQL, with better performance and some extended features. I decided to see how “drop in” it really was by updating this site to use it.

As it turns out, it was a completely seamless upgrade. This isn’t incredibly surprising since one of the original mainstays of MySQL was that it was easy to get up and running. Since “the orignal MySQL” is now represented more by MariaDB, the team has done much to make sure that everything is smooth to get going.

The first step to doing such an upgrade is of course to back up anything that could possibly get affected. Here that means the actual database files, as well as the configuration. Mine are located in the standard places for an Ubuntu installation of MySQL.

/etc/init.d/mysql stop
cd /var/lib
cp -a mysql mysql.orig
cd /etc
cp -a mysql mysql.orig

These commands will shut down MySQL and make backups of the data and configs. Next is to install MariaDB. The MariaDB team provides repositories for most popular Linux distros, including the one I’m using. In case you don’t want to bother with their wizard, the following commands will set up their repository for Ubuntu Lucid.

apt-get install python-software-properties
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu lucid main'

You’ll want to change lucid in that last line to reflect the specific distro you’re using. After that, a simple

apt-get update
apt-get install mariadb-server

This will take care of uninstalling the MySQL stuff you already have and putting MariaDB in there instead. After that, start it up with

/etc/init.d/mysql start

All of the commands are identical to MySQL, so don’t worry that there’s not a mariadb script in /etc/init.d, this is by design.

As far as I can tell, everything was perfect and I didn’t actually need my backups. Everything is working smoothly, and I have a new, shiny MariaDB installation to play around with. If anybody has any other thoughts about MariaDB please don’t hesitate to leave a comment!

6 thoughts on “Switching the Blog to MariaDB

    1. chris lea Post author

      Unfortunately there’s nothing interesting to report on that front. I wanted to see how things would work with zero modifications from my MySQL installation, so I used the same configs. As a result, I’m still just using boring MyISAM tables for everything.

      Reply
  1. Anthony Ogden

    I can confirm it was really simple on Ubuntu 13.04 using a repo listed on the mariadb site. Just make sure to remove the mysql-server and mysql-client packages first.

    Reply

Leave a Reply