CPanel: upgrading to MySQL5
CPanel has included support for MySQL 5 in all its latest releases - 10.8.2-xxx - (Stable/Release/Current). I find this very cool and it is a big difference in trying to get MySQL4 to run on Plesk for example. Anyway the upgrade process is very simple, and probably no one will need any additional information to complete this safely. I just wanted to point out some of the problems you might encounter in performing this upgrade.
How can you upgrade to MySQL5? Simply login to the WHM interface, and from “Server Configuration / Tweak Settings” choose in the “MySQL” section the 5.0 radio button. Then click “Save” and you are done. This will actually run the script: /scripts/mysqlup that will download and install the latest MySQL5 rpms available at that time.
After completion as instructed you should rebuild your perl mysql libraries and rebuild apache (to have php build against the newly installed mysql library).
/scripts/perlinstaller --force Bundle::DBD::mysql
and for apache/php:
/scripts/easyapache
or you can see this post for more details on compiling apache/php on CPanel from WHM.
What should you be aware prior to perform this upgrade? Here are some issues that you might find useful to know before doing this…
1. The upgrade is not reversible…
Even if you see the warning and this is even in bold:
“Updating from a previous verion of MySQL to a later version is not automaticlly reversable. You should backup your databases if you think you might wish to downgrade in the future.”
you might not believe it… Well I have not believed it as I have performed safely downgrades to mysql4.1 in case of problems on manual installs of mysql. But in this case CPanel is telling the truth… After you will complete the upgrade in WHM the choice for MySQL 4.1 (the radio button) will disappear and you will no longer be able to choose it. You can probably downgrade manually if you really need to, by downloading the MySQL4 rpms and install them manually from the command line while removing the MySQL5 ones. In this case you might find useful the link to the location of CPanel rpms:
http://updates.cpanel.net/pub/mysqlinstall/
2. MySQL might fail to start…
Since I have done this only on RHEL4 servers I am not aware if this problem exists on other distributions as well. But in RHEL the MySQL5 init script was failing after the upgrade with the following error:
/etc/init.d/mysql start
Starting MySQLCouldn't find MySQL manager or server [FAILED]
Tracking down this error I found out that the MySQL configuration file (/etc/my.cnf) installed by the upgrade had a wrong line that was causing this behaviour:
/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
#old_passwords=1
[mysql.server]
user=mysql
basedir=/var/lib # <= you will need to comment this line
old-passwords = 1
[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
The line basedir=/var/lib was causing the error and in case you are having the same problem commenting out that line will solve the problem and MySQL will start properly.
These are the 2 issues I have found out when upgrading MySQL5 and hopefully you will be aware of them prior to loosing too much time trying to solve them
Besides this MySQL5 is running fine and I have not found any problems in normal operation or with the integration with other CPanel functions. Have fun.
Share This








19th July 2006, 20:17
Thanks this article was very helpful
16th January 2007, 00:47
Thank you so much! I became super panicked when I was getting all sorts of mysql errors after the upgrade. Anyway, you saved the day!
Thanks,
dg
2nd February 2007, 12:07
Thanks for documenting the my.cnf error. I too was having all sorts of problems but your blog entry saved the day!
13th February 2007, 04:03
Thanks for the help, i can start mysql only to some extent and then it stopped. my command line is ’service mysql start’, here is what i got
’starting mysql……………………………. [failed]. appreciate your help.
13th February 2007, 21:17
ted,
Check your mysql logs to get more informations about the error. Without that information I don’t have any idea what is the problem in your case.
21st March 2007, 15:17
Is there any way to have a MySQL version used that includes the SSL bindings? All version 5.1x of MySQL have the SSL bindings included by default, but Cpanel only seems to support up to 5.0.27 so far and NOT the SSL bindings included. Would cpanel break if I manually compilled and installed or used a RPM for the 5.1x version of MySQL in order to have SSL bindings included.
By the way, I got this to work but DID have to comment out the basedir line to get the deamon to start.
9th June 2007, 20:41
You are my savior thank you so much for the tip to comment the basedir. It worked for me. I was totally lost for second after upgrading from 4 to 5.
Thanks you so much for the article.
10th June 2007, 09:59
Imthiaz,
You are most welcome!. I’m happy this helped you when needed.
Cheers,
- Marius -
10th June 2007, 20:15
Thanks for the #commenting hint, really helped out
23rd August 2007, 22:23
your advice was on point……thanks man….
19th September 2007, 03:20
Thanks for providing these instructions Marius - very helpful and useful!
13th October 2007, 16:31
It helped me well. Thanks a lot
28th November 2007, 14:03
Hei, Thanks. It’s very usefull and helped a lot
24th February 2008, 17:50
I’d just like to add my thanks as well. After my upgrade my MySQL wouldn’t start. If it wasn’t for your blog post I would have been in a major panic. Thank you again!
17th March 2008, 01:59
[...] thanks to [ducea.com] [...]
7th April 2008, 23:03
where run /scripts/mysqlup
get this error:
error: failed to stat (deleted) /var/tmp: No such file or directory
how can fix it?
8th April 2008, 08:59
Mavara: i am not sure if this is related to this post, or even to cpanel… You might want to check and see if /var/tmp exists and has the proper permissions, and if not recreate it. You might want to check why it doesn’t exist as this is strange and might indicate something strange happening on your system.
4th June 2008, 19:10
Hi , i was reading this and just wanted to point if you wish downgrade from 5 to 4.1 there is a way so cpanel show the 4.1 version again in the tweak section, just edit /var/cpanel/cpanel.config and change the value in:
mysql-version=4.1
Then cpanel will show the 4.1 in the tweak section.
10th June 2008, 19:43
Manuel: thank you for your addition. This might help users that need to revert back, even though this is an old post and most people should be already on mysql5.