If you manage your own CMS blog or website with full server access, then you probably know a thing or two about MySQL database servers. You may have also heard of MariaDB, if not don’t worry, it’s just like MySQL Server at least at this point in time.

So, why I am writing this? Well, because we’ve just migrated our MySQL database server to MariaDB on this site without a glitch. I wasn’t sure the migration would go without a problem. In fact, I anticipating a down time of few hours while we try to restore the database server.

Well, that didn’t happen and everything went without any issue.

Now, if you ask why we had to migrate, I’d tell you there was no reason whatsoever. None, because MySQL was working just fine when we decided to migrate. You don’t hear this often, do you?

So why MariaDB? You see, MySQL Server is owned my Oracle, the giant database company. Oracle seems like a great company to me, but it has real problems with the open source community. Every open-source project it touches or acquires, the community flees from it.

It’s happening to Java, Open Office and now MySQL.

Now the open source community is now moving towards MariaDB. MariaDB is a drop-on replacement for MySQL. It’s work exactly like MySQL except the name has changed. In future releases, the differences between the two communities might widen and most folks may end up with MariaDB.

Maybe that’s why we switched.

Anyway, here’s how to migrate to it in Ubuntu and CentOS distributions.

Before you start migrating, please make sure to backup your databases. To learn how to do that, please read our previous post on backing up MySQL databases.

Switching to MariaDB in Ubuntu

After backing it up, run the commands below to stop MySQL server.

sudo service mysqld stop

 

Next, run the commands below to remove MySQL Server from your host.

sudo apt-get remove mysql-server mysql-server-5.5 mysql-server-core-5.5

 

Next, run the commands below to add MariaDB repository’s key to your machine.

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db

 

Than run the commands below to add MariaDB software repository.

sudo add-apt-repository 'deb http://mirror.aarnet.edu.au/pub/MariaDB/repo/10.0/ubuntu quantal main'

 

Finally, run the commands below to install mariaDB.

sudo apt-get update && sudo apt-get install mariadb-server

 

Switching to MariaDB in CentOS

For users with CentOS, run the commands below to remove MySQL from your machine.

yum remove mysql*

 

Next, run the commands below to add MariaDB repository.

vi /etc/yum.repos.d/MariaDB.repo

 

Then copy and paste the lines below into the file and save it.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

 

Finally, run the commands below to install it.

yum install MariaDB-server MariaDB-client

 

Enjoy!