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!

Frequently Asked Questions

What is MariaDB and how does it differ from MySQL?

MariaDB is a drop-in replacement for MySQL, functioning similarly but with some differences. It's gaining popularity due to being more community-driven and open-source.

What are the advantages of migrating from MySQL to MariaDB?

Migrating to MariaDB can offer benefits like improved performance, better security features, and a more community-friendly environment compared to MySQL.

What are the steps to migrate from MySQL to MariaDB in Ubuntu and CentOS distributions?

To migrate from MySQL to MariaDB in Ubuntu and CentOS, ensure you back up your databases first. Then follow the specific commands and procedures outlined for each distribution.

Why is the open-source community shifting towards MariaDB from MySQL?

The open-source community is favoring MariaDB over MySQL due to concerns with Oracle's management of MySQL and a preference for the more community-focused approach of MariaDB.

Is there a specific reason for migrating from MySQL to MariaDB if MySQL was functioning well?

In some cases, people migrate from MySQL to MariaDB even if MySQL is working fine. Reasons could include a desire to align with the growing community support for MariaDB and future compatibility concerns.

What precautions should be taken before migrating from MySQL to MariaDB?

Before migrating to MariaDB, it's crucial to back up all databases to ensure no data loss during the transition. Proper backups help in case any issues arise during the migration process.

How can one ensure a smooth transition when migrating from MySQL to MariaDB?

To ensure a seamless migration from MySQL to MariaDB, follow the recommended steps, execute the necessary commands accurately, and monitor the process closely for any errors or issues.

What are the key differences between MySQL and MariaDB that users should be aware of?

While MariaDB is designed as a drop-in replacement for MySQL, users should be aware of potential differences in features, performance optimizations, and ongoing community support between the two database systems.