Upgrading Redmine to MariaDB

in Redmine, ruby, MySQL, centos

On a stock CentOS installation ( DB wise, ie MySQL 5.1 ) we decided to roll out MariaDB. And it was wonderful, as all our LAMP apps didn't even seem to notice that something has changed. Not the same could be said about Redmine though...

Here's the lowdown:
Redmine (and I guess, all RoR apps) need a compiled version of the mysql2 adapter to work, which is compiled on your system. The common error you get after the upgrade is this one:


Incorrect MySQL client library version! This gem was compiled for 5.X.XX
but the client library is 5.XX.XX.

version numbers are different obviously, but the context should always be the same - it means you've compiled your mysql driver with a different header version than the current. So what now?

Well the first step is to download the devel package for the current version. In the case of MariaDB 5.5, that's done by running


# yum install MariaDB-devel

from the terminal. Once that's done, you need to recomile your gem, which is easily done via:


# gem install mysql2

Once that's done (it's quite fast), you probably don't even need to restart Apache - just refresh the error page and enjoy!

Do note that if you have not installed Ruby globally to your system, you probably need to prefix that last line with the path to gem, such as /opt/ree187/bin/gem in our case