Share This

Thursday, August 18, 2016

Switching MySQL 5.x to MariaDB 10.x on Ubuntu 14.04

If you are going to use MariaDB to replace existing implementation of MySQL in production environment, then you will realize changing a DBMS to one another has never been easier considering the risks of incompatible supported features and functionalities, unpredictable development time and resources, migrating a huge amount of data and so on. MariaDB has already succeeded as a "drop-in" replacement  for MySQL and is truly open source and more optimized, faster and safer.

Though being mentioned that Migration might become difficult after 2015, below is a few steps which I believe is quite simple to install MariaDB replacing MySQL on Ubuntu 14.04.x as I came across the same requirement switching MySQL 5.5.5 to MariaDB 10.1.14.


1. Get the signing key to be imported and commands to be executed from the mariadb.org's download site at https://downloads.mariadb.org/mariadb/repositories/. By choosing types of Distro, Release, Version and a Mirror, a customized repository configuration will be generated as described below:




















2. Though not necessary, you might want to backup important databases and configurations. In  order to uninstall MySQL, stop MySQL service and perform apt-get remove, autoremove and autoclean as below:
sudo service mysql stop
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean


3. Now it's time to install MariaDB, execute the commands generated in Step 1.





4.
It's possible that one might encounter an error during the installation, something like
[ERROR] Missing system table mysql.roles_mapping; please run mysql_upgrade to create it

Then, simply do the following:
sudo mysql_upgrade

If permission required or already installed, use --force as below
sudo mysql_upgrade -uroot -p --force

Also, in my case I have to upgrade php5-mysql as below:
apt-get install php5-mysql

Finally, check php.info() and look for MariaDB parts, if it shows something like described below, then cheers! Now you can try some new features for e.g. REGEXP_REPLACE() available since MariaDB 10.0.


No comments:

Post a Comment