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


Share

4 thoughts on “Switching MySQL for MariaDB on Ubuntu.”

  1. Hello,

    I’m getting for following error when I tried to replace mysql with mariadb. I’m running Ubuntu 9.10. Do you have any idea?

    sudo apt-get install mariadb-server-5.1

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    mariadb-server-5.1: Depends: mariadb-client-5.1 (>= 5.1.49-mariadb82) but it is not going to be installed
    Depends: mariadb-server-core-5.1 (>= 5.1.49-mariadb82) but it is not going to be installed
    E: Broken packages

    1. Hi,

      With Karmic try removing all the mysql packages first….

      sudo apt-get purge mysql-server-5.1 mysql-client-5.1 mysql-common etc

      I’m not 100% sure these are the correct package names as the 5.1 suffix has been dropped on more recent versions (as 5.0 is no longer supported).
      If you run something like….

      dpkg -l | grep mysql

      It’ll list all installed packages matching ‘mysql’

      Hope this helps!

Leave a Reply