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.