How to upgrade to MySQL 5.5 on CentOS

If you buy virtual hosting these days and it comes built with CentOS and Parallels chances are you will be stuck with MySQL 5.1 . Why is this bad? Aside from being old and outdated you may notice that some of your WordPress migrations now won’t work. If you are getting the following error during your mysql import:

#1273 – Unknown collation: ‘utf8mb4_unicode_ci’

This is because MySQL 5.1 doesn’t support 'utf8mb4_unicode_ci' collation and you need at least MySQL 5.5.3 for it to work. Thankfully it’s pretty easy and painless process to upgrade your MySQL. This was done on Parallels 12.8

Requirements

  1. You are familiar with SSH and have root access to your server
  2. You mysql installed on Centos

Prepping for install

Once you have SSHd into your server do a check to make sure that mysql is installed by typing:

rpm -q mysql mysql-server

RESULT:
mysql-5.1.69-1.el6_4.x86_64
mysql-server-5.1.69-1.el6_4.x86_64

Add Atomic repo to make sure we get the latest version:

wget -q -O - http://www.atomicorp.com/installers/atomic | sh

Upgrade MySQL:

Now upgrade mysql:

yum upgrade mysql

you should get a list of installed dependencies as well. Now it’s time to upgrade the current databases with (you might need to add a ‘-f’ at the end to force it)

mysql_upgrade -uadmin -p`< /etc/psa/.psa.shadow

Wrapping it up:

You should be all good now. It’s a good idea to restart the service

sudo service mysqld stop
sudo service mysqld start
sudo service mysqld status
mysqld (pid NNNN) is running...

You can now import your sql files with utf8mb4_unicode. Yey!!

While you in terminal already making your server better, why not install Google PageSpeed to speed up your site 🙂

 

4 responses

  1. Thanks, this certainly helped me get past having to go through the whole install routine when cloning a WordPress site (you end up with all the plugins but no posts, pages, users or settings because the database has not loaded). I had concluded that all cloning or duplicating plugins had been broken by a WordPress update. But this is the reason! I upgraded as here, and the clone worked as it should.

    One thing, after typing in mysql_upgrade -uadmin -p`< /etc/psa/.psa.shadow be prepared to wait. It may take a long time. Difficult to tell therefore if you need to do the same adding -f … perhaps best to just do that.

  2. Thanks, this certainly helped me get past having to go through the whole install routine when cloning a WordPress site (you end up with all the plugins but no posts, pages, users or settings because the database has not loaded). I had concluded that all cloning or duplicating plugins had been broken by a WordPress update. But this is the reason! I upgraded as here, and the clone worked as it should.

    One thing, after typing in mysql_upgrade -uadmin -p`< /etc/psa/.psa.shadow be prepared to wait. It may take a long time. Difficult to tell therefore if you need to do the same adding -f … perhaps best to just do that.

Leave a Reply