Migrating Redmine (or any Passenger app) from MySQL to MariaDB

I recently tried moving from MySQL to MariaDB, and was truly surprised with the results - everything works just fine, didn't even have to recreate users/databases. Well, everything except Redmine (and I would assume, and other Passenger app).

The thing to remember here is that gem extensions are compiled against the libraries you have on your system. In my case, to replace MySQL with MariaDB was a simple task of removing the MySQL packages, installing the MariaDB repo and packages, and replacing my old MySQL config ( which was removed by my package manager along with the MySQL packages ). Hence the libraries the gem expects are not there anymore.

If you are looking for information on migrating from MySQL to MariaDB on CentOS 6.4 -- this is the article you're lookin for. Do note that for stock yum MySQL to MariaDB 5.5 migration, I skipped steps 4,7,9 since MariaDB picked up on exisitng users and databases without any issue.

Getting it all to work is a simple case of recompiling the gem with the new libraries -

 

$ gem install mysql2 -- --with-mysql-config=/usr/bin/mysql_config

 

In case you're using Ruby Enterprise Edition (which I am) you probably need to prepend you installation path (which I didn't, and was the cause of some hair pulling):

 

$ /opt/ree187/bin/gem install mysql2 -- --with-mysql-config=/usr/bin/mysql_config

 

Do note that in order for this to work, I assume you have installed the recommended setup - that is, the MariaDB repo along with the packages MariaDB-devel MariaDB-client MariaDB-server

Hope this helps someone