Changing Mysql for MariaDB

Ok so i quit smoking 4 days ago now. And i am having some serious sleep issues at the moment. i have been up half the night sitting here staring at my screen. But nothing really productive comes out of my hands. So while doing a bit of browsing i hit the MariaDB page. And has been while since i was here. The last time there was no real downloadable package yet. But this has all changed.

So that made me think about last week. I think it was on Friday. but there was some up stirring about MySQL (Oracle) asking a license fee for using the InnoDB storage engine. And quite a big fee if you ask me :) This really sucks. I love the InnoDB engine. What would we do without it…? That’s where MariaDB comes into play. It uses the XtraDB storage engine which is basically InnoDB on steroids. XtraDB is developed and maintained by Percona. Some really smart MySQL guys :) At the moment it’s under the GPL license. And i can only hope it will be freely available for a long time.

So i went ahead and took a look at how hard / easy it is to change MySQL for MariaDB. I tried this on a Debian Lenny machine which made the process quite easy i have to mention.

First get the PGP key from the server and import the repository locations. After that hit update to refresh the local database.

  • $ wget -O- http://ourdelta.org/deb/ourdelta.gpg sudo apt-key add -
  • $ cd /etc/apt/sources.list.d; wget http://mirror.ourdelta.org/deb/sources/lenny-mariadb-ourdelta.list
  • $ aptitude update

As we can see we have some new packages

Get:8 http://mirror.ourdelta.org lenny/mariadb-ourdelta Sources [864B]
Current status: 3 updates [+3], 232 new [+11].

Searching for ‘mariadb’ gives the following packages

$ aptitude search mariadb

p   libmariadbclient-dev              - MariaDB database development files
p   libmariadbclient16                - MariaDB database client library
v   libmariadbclient16-dev            - MariaDB embedded database development files 
p   mariadb-client                    - MariaDB database client (metapackage depending on the latest version)
p   mariadb-client-5.1                - MariaDB database client binaries
p   mariadb-client-core-5.1           - MariaDB database core client binaries
v   mariadb-common 
p   mariadb-server                    - MariaDB database server (metapackage depending on the latest version)
p   mariadb-server-5.1                - MariaDB database server binaries
p   mariadb-test                      - MariaDB database regression test suite (metapackage depending on the latest version)
p   mariadb-test-5.1                  - MariaDB database regression test suite

So let’s go ahead and install the server and see what happens.

$ aptitude install mariadb-server

Some mysql files get removed the mysql-common package gets updated and the new MariaDB packages get installed.

  • The following NEW packages will be installed:
  • libmariadbclient16{a}
  • libmysqlclient16{a}
  • mariadb-client-5.1{a}
  • mariadb-client-core-5.1{a}
  • mariadb-server
  • mariadb-server-5.1{a}
  • The following packages will be REMOVED:
  • mysql-client-5.0{a}
  • mysql-server{a}
  • mysql-server-5.0{a}
  • The following packages will be upgraded:
  • mysql-common

Now that’s done. Let’s check MySQL’s output

$ mysql –version * mysql Ver 14.16 Distrib 5.1.49-MariaDB, for debian-linux-gnu (i486) using readline 5.1

Just as i expected. Nothing really changed here. The whole MySQL API is till available for calling. Only the base system is now replaced by MariaDB. So let’s see what storage engines are available.

$ mysql -uroot -p

  • MariaDB [(none)]> show engines;
  • BLACKHOLE _/dev/null storage engine (anything you write to it disappears) _
  • MRG_MYISAM _Collection of identical MyISAM tables _
  • FEDERATED _FederatedX pluggable storage engine _
  • MARIA _Crash-safe tables with MyISAM heritage _
  • **CSV ** _ CSV storage engine _
  • **MEMORY ** _Hash based, stored in memory, useful for temporary tables _
  • **ARCHIVE ** _Archive storage engine _
  • MyISAM _Default engine as of MySQL 3.23 with great performance _
  • InnoDB _Supports transactions, row-level locking, and foreign keys _
  • PBXT High performance, multi-versioning transactional engine

And because the MySQL APi is still in tact. From PHP we can keep using the mysql and mysqli interfaces. This is great stuff!

comments powered by Disqus