Upgrading to MySQL 5.1 and PHP 5.3.0 on Centos with Plesk

This is an account of my experience trying to upgrade MySQL to version 5.1 on my MediaTemple (dv) 3.5 dedicated virtual server. It may help people not on MediaTemple servers, especially if you’re trying to upgrade MySQL without damaging Plesk. There are a lot of forum posts out there that lead you down the wrong path so beware.

Before you go any further, this could really mess up your server and its not totally tested so if you have anything you depend on, I would be very careful. In this process I actually had to do a complete restore because I screwed the server up so royally before I figured everything out.

First, obviously, you need to install the developer tools through the (mt) control panel which enabled root access and SSH. Then you need to install yum, following the directions in the (mt) knowledgebase article. There’s also a note at the bottom of that article about removing SiteBuilder, which you should do, but don’t bother installing the atomix repository.

Then, you’ll see that mysql 5.0.x is the latest in the existing repositories. Remi’s repos have all the latest goodies so we need to enable that. This page is helpful: http://blog.famillecollet.com/pages/Config-en

wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

A quirk about centos is that after adding a repo it’s not actually enabled by default. There are two ways to go about getting access to the files. Either add the option –enablerepo=remi to the yum command or edit the /etc/yum.repo.d/remi.repo file and change enabled=1. Now if you do yum –enablerepo=remi info mysql it SHOULD say the latest 5.1.x version. But there are a couple other tricky bits.

If you try upgrading mysql you’ll notice that there are two packages creating conflicts. php-mhash and php-ncurses. Those two packages are safe to remove (yum remove php-mhash php-ncurses). Now you should be able upgrade mysql, which will also upgrade php to 5.3.0 (but if you try to upgrade php alone, you’ll get errors). yum –enablerepo=remi upgrade mysql

You’re almost there. You’ll notice that mysql won’t start, which is because there are old settings in /etc/my.cnf that trip it up. I’m doing this upgrade on a completely fresh system and I don’t have to worry about loosing any settings or even any databases that already exist, so I moved /etc/my.cnf to a new location and restarted mysql, which regenerates a fresh my.cnf. The final step is to run “mysql_upgrade -u admin -p”. The password is your plesk admin password.

The one unsolved part of this mystery is updating the plesk tables. All of these tables fail the update script. Still, I’ve clicked around and Plesk seems to be working OK.