How to upgrade to MySQL 5.5 and PHP 5.4 in Plesk 11.5 (CentOS)

Plesk-LogoOne of my clients wanted to run a web application that required MySQL 5.5 instead of the default MySQL 5.1 that ships with Plesk at the time of writing. He needed it due to the better handling of UTF8 characters.

I struggled to find clear instructions on how to do this – so here they are ;-)

CentOS 5.x

In CentOS 5 you can switch to MySQL 5.5 under Tools and Settings – Updates and Upgrades. The installer shows something like this:

Screen Shot 2014-02-16 at 11.46.19

Simply switch to MySQL 5.5 (packaged by Parallels) and hit install.

CentOS 6.x

Sadly the above convenience doesn’t exist in CentOS 6, so we’ll have to make use of the excellent Atomic repository again. In the past I’ve experienced instabilities in the way Plesk may react to non-standard repo packages – but it appears this is no longer an issue (or so I was told). Suffice to say proceed at your own risk and test, test and test again before using this in a production environment.

Install access to the Atomic repo with this command:

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

You’ll have to agree to some terms and conditions, after which you can simply use yum update to include some additional functionality that is not provided by CentOS or Parallels. Doing so will automatically update both MySQL and PHP for you.

Restart the server when you’re finished for good measure.

Testing: Before and After

You can check which versions are installed. I’d recommend you do this before and after the update.

To check the current PHP version execute the following:

php -v

// before
PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.

// after
PHP 5.4.25 (cli) (built: Feb 10 2014 08:04:23) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd.

MySQL will show you the version number as soon as you log in to the command line. Do it with this command which will extract the current MySQL admin password from the Plesk database:

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

// before
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 747
Server version: 5.1.73 Source distribution

// after
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.5.36-cll-lve MySQL Community Server (GPL) by Atomicorp

Run the MySQL upgrade script

To complete the MySQL upgrade, there’s a command which updates all existing databases on the system (including psa). Thanks to my client for pointing this out ;-)

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

I’ve heard that in rare cases you may have to use some –force here.

Let me know if this helps!

You can leave a comment on my original post.