Upgrading to MySQL 5 via cPanel
After running Apache 1.3, PHP 4.3 and MySQL 4.1 for historical compatibility reasons for a long time, I finally decided to rewrite some old code, update some old tools and update the server software to the new branches. I felt really good about it all until MySQL refused to start.
Those of us who run cPanel on our servers do it because it makes handing out accounts incredibly easy, but unfortunately it also makes you responsible to others which adds a certain amount of urgency and stress to every upgrade. The last thing you want is for some silly little oversight to break every website on your server.
The upgrade to Apache 2.2 and PHP 5.2 via cPanel's WHM went extremely well, but for some reason my freshly downloaded MySQL 5.0 simply refused to start, instead throwing out errors all over the place. That's really the last thing you need at 04:00, when you're trying not to screw up other people's websites.
As it turns out the solution was rather simple. So simple actually, that it's pretty disappointing that this hasn't been addressed by the cPanel folks by now. After letting cPanel's WHM do its thing, crack open your favourite SSH client and edit your MySQL configuration file (/etc/my.cnf) and look for a line in the [mysql.server] section that looks like:
[mysql.server]
basedir=/var/lib
You'll simply want to comment that out, so that it looks like:
[mysql.server]
# basedir=/var/lib
Once you've saved that, you can leave the scary console alone and retreat to the relative safety of WHM. Scroll all the way down to 'Restart Services' and give MySQL a good kick in the pants -- it should start this time.
As an aside to fellow wordpress users, WP now requires PHP 4.3 at an absolute minimum, but as the PHP folks are no longer supporting the 4.x branch it's probably a good idea to upgrade sooner rather than later.
Trackback





Upgrading MySQL 4.1 to 5.0 in a cPanel/WHM environment is very easy. Simply go to WHM -> Server Configuration -> Tweak Settings -> MySQL. Select the version you wish to use and follow the instructions there to complete the installation. No manual downloads required.
I recommend performing a backup prior to upgrading as the databases are not readily downgradable to 4.1 if you wished to revert back to MySQL 4.1.
I appreciate your post David.
Of course that’s exactly what I did in order to upgrade to MySQL 5.0… when I said it was freshly downloaded, I didn’t mean that I manually did it. Nevertheless, cpanel’s scripts did indeed freshly download it for me.
Unfortunately upon following the instructions, including rebuilding apache, MySQL refused to start until I commented out the line mentioned.
I think it’s worth looking into, since it’s an easy patch on your part.
Cheers.
Thanks for the tip! I found your site via Google - I had the exact same problem - MySQL wouldn’t start. I was so worried!
I did your fix and it worked. Silly cPanel devs.
Damn! Am I glad I found your post!!!
I had the EXACT same problem, but I was so LUCKY. I found your post a few minutes BEFORE I was to upgrade. I had the same problem, but was ready, and only had about 30 seconds of downtime before I changed the config… Thanks!!!!
Wow I wish I had the good sense to google stuff before actually doing it :)
glad to be of help.