How-to: Switching WordPress from MySQL 5.1 to MariaDB 5.5 on CentOS/RHEL 6

Recently, I was somewhat bored and decided to switch from a MySQL 5.1 backend to MySQL 5.5 for my site (of which you have the distinct pleasure of reading).  While doing a little Googling,  I remembered MariaDB. MariaDB is marketed as “An enhanced, drop-in replacement for MySQL”, so I figured why not give it a shot?

Oh yeah, it’s also not tainted by Oracle (at least in an ownership-sense). Anyways, no matter your opinion on aforementioned company, it turned out the upgrade process itself was pretty easy. The first thing you will want to do is take some dumps of your SQL database in case things go awry. I utilized the Better WP Security plugin’s functionality for this, but there are a variety of ways to do this.

Once you have your database backed up, you’ll want to setup the MariaDB repo by using their handy dandy Repository Configuration Tool. For a CentOS 6 64 bit system, mine looked like this:

# MariaDB 5.5 CentOS repository list - created 2013-06-22 19:07 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

You’ll want to place this in a file, I called mine mariadb.repo, located in /etc/yum.repos.d/. It’s not necessary, but next I like to clear my yum cache:

# yum clean all

You’ll then want to check that the repo is enabled and you can see packages available:

# yum repolist

What you’re looking for in the output is something along the lines of:

repolist mariadb

Next, stop MySQL:

# service mysql stop

Remove the mysql-server and mysql packages:

# yum erase mysql-server mysql

You’re now ready to install MariaDB:

# yum install MariaDB-server MariaDB-client

Once that completes, you’ll need to start “mysql” (MariaDB) again

# service mysql start

The final step is to upgrade your databases (included below is some sample output):

# mysql_upgrade -u root -p
Enter password: 
Phase 1/3: Fixing table and database names
Phase 2/3: Checking and upgrading tables
Processing databases
information_schema
mysql
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
wordpress
wordpress.rm2mjw3_bwps_lockouts                    OK
wordpress.rm2mjw3_bwps_log                         OK
wordpress.rm2mjw3_commentmeta                      OK
wordpress.rm2mjw3_comments                         OK
wordpress.rm2mjw3_links                            OK
wordpress.rm2mjw3_options                          OK
wordpress.rm2mjw3_postmeta                         OK
wordpress.rm2mjw3_posts                            OK
wordpress.rm2mjw3_term_relationships               OK
wordpress.rm2mjw3_term_taxonomy                    OK
wordpress.rm2mjw3_terms                            OK
wordpress.rm2mjw3_usermeta                         OK
wordpress.rm2mjw3_users                            OK
wordpress.rm2mjw3_wpeditor_settings                OK
Phase 3/3: Running 'mysql_fix_privilege_tables'...
OK

You should now be successfully running MariaDB 5.5!

Leave a Reply

Your email address will not be published. Required fields are marked *