Switching MySQL for MariaDB on Ubuntu.

MariaDB offers quite a few improvements over MySQL, mainly in the storage engines it provides. Firstly, the Maria engine is a crash safe version of MyISAM which in the future will also support transactions. Secondly, the XtraDB engine is an enhanced version of Innodb which can give considerable speed improvements over the standard Innodb engine. There are many other features and improvements over the standard MySQL distribution, move info on the differences can be found here: http://askmonty.org/wiki/MariaDB_versus_MySQL

The easiest way to install MariaDB is to add one of the repositories, I’ve used OurDelta:

wget -O- http://ourdelta.org/deb/ourdelta.gpg | sudo apt-key add -
sudo wget http://ourdelta.org/deb/sources/lucid-mariadb-ourdelta.list -O /etc/apt/sources.list.d/ourdelta.list

Then install MariaDB:

sudo apt-get install mariadb-server-5.1

This should install MariaDB without any problems, it should also replace MySQL if you already installed it:

# apt-get install mariadb-server-5.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libmariadbclient16 libmysqlclient16 mariadb-client-5.1
  mariadb-client-core-5.1 mariadb-server-core-5.1 mysql-common
Suggested packages:
  tinyca mailx mariadb-test
The following packages will be REMOVED
  libmysqlclient-dev libmysqlclient16-dev mysql-client mysql-client-5.1
  mysql-client-core-5.1 mysql-server-5.1 mysql-server-core-5.1
The following NEW packages will be installed
  libmariadbclient16 mariadb-client-5.1 mariadb-client-core-5.1
  mariadb-server-5.1 mariadb-server-core-5.1
The following packages will be upgraded:
  libmysqlclient16 mysql-common
2 upgraded, 5 newly installed, 7 to remove and 8 not upgraded.

If you are upgrading from MySQL, you will probably be prompted to overwrite the my.cnf and for a new root password. I generally choose Y to overwrite and enter my existing root password to avoid issue.

You can also follow my previous post to upgrade the client library used by PHP, rather than installing the MySQL dev package, the Maria equivalent should be used:

sudo apt-get install libmariadbclient16-dev