Featured Posts

Using DKIM with Exim and cPanel Similar to the intentions of SPF records and DomainKeys, DKIM is intended to authenticate a sender by using a public/private key pair to digitally sign email, therefore increasing deliverability. At this...

Readmore

Copy Outgoing Email on a cPanel Server with Exim A common request we get is how a user can automatically BCC outgoing email to another address. This is most often requested by law firms that need to be able to retain copies of communication. Forwarding...

Readmore

Do You Care About Your Customers' Data? I was working a case last week for a new client that's been hosting local business websites for over three years. As with all of my case studies, I did a short survey of the client's infrastructure, processes,...

Readmore

Tips to Reduce Your Customer Support Costs When hosting websites, whether as a mainstream hosting provider, a hobby, or to supplement another service, it's your job to make sure your customers have access to technical support in case they need...

Readmore

Roundcube: MySQL or SQLite? cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I've come to the conclusion that SQLite is definitely...

Readmore

The cPanel Admin Rss

Manually Upgrading MySQL

Posted by Mark | Tagged under , | Posted on April 13, 2011

2

If at all possible, you should use /scripts/mysqlup to do a MySQL upgrade, however, if you need a version of MySQL outside of what they are offering in current cPanel versions, it is possible to upgrade manually.

These are the instructions for performing a manual upgrade of MySQL to 5.1.30, but this typically applies to all versions over 4.1 and higher. Typically it is best to upgrade to whatever the latest stable branch of MySQL is and apply these instructions to install the RPMS.

If this is on a live system, make sure to make backups of the databases.


mkdir /root/dbbackups

touch /root/dbbackups/list
for db in `mysql -e 'show databases' |awk '{print $1}' | grep -v Database`

do

mysqldump --add-drop-table $db > /root/dbbackups/$db.sql && echo $db >> list

done
mkdir /root/sqllibs
cp /usr/lib/libmysqlclient.* /root/sqllibs

Do a search for all installed MySQL packages to be removed:
rpm -qa | grep -i mysql-

This should present a list of 5 or 6 MySQL RPM’s that are installed, likely. Uninstall them one by one with the rpm -e like so:
rpm -e MySQL-devel-4.1.21-0.glibc23

Some packages are dependencies of each other, so you may need to remove one before being able to remove another.

Download the binaries for the OS version and MySQL version you are using from the cPanel repo:
http://httpupdate.cpanel.net/mysqlinstall/

execute rpm -i for each package (ex: pm -i MySQL-client-5.1.30-0.glibc23.i386.rpm)

Edit /var/cpanel/cpanel.config and change the MySQL version to 5.1 (or whatever version you’re running now). Then run this command:
touch /etc/mysqlupdisable

This will keep cPanel from resetting or reverting back to its original MySQL version during updates.

Restart MySQL first to make sure that it can at least start (which it should). Once you’ve verified this, run mysql -V to make sure that the correct version is installed. You should see output similar as below:
root@server [~]# mysql -V
mysql Ver 14.13 Distrib 5.1.30-beta, for pc-linux-gnu (i686) using readline 5.0

MySQL should now be up and running, but it’s likely that trying to log in directly as the root user will fail. Before Following the below steps, make sure you can do a ‘mysql -u root’ and log in successfully. If not, you’ll need to set the root password. By default, MySQL has a blank root password which will need to be set to ours…twice.
Recopy the libs, but don’t overwrite any that already exist:
mv /root/sqllibs/libmysqlclient.* /usr/lib/mysql/

Next update cPanel’s PHP and DBD MySQL bundle for perl by executing the following:
/scripts/perlinstaller --force Bundle::DBD::mysql
/scripts/makecpphp

Verify that phpMyAdmin and php -m load properly and without errors.

 

Liking this article? Share it and spread the word!
  • Print
  • PDF
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts:

Comments (2)

[...] Click here for instructions on manual upgrades [...]

This is a nice article. There are, however, a few things I’d like to point out (in no particular order):

1. touch /etc/mysqlupdisable. You can also do this in /etc/cpupdate.conf, by changing or adding MYSQLUP=never

2. I’d recommend moving /etc/my.cnf out of the way. Depending upon which version of MySQL you are installing, if you have a customized /etc/my.cnf file, it is quite possible for entries therein to cause complications during the install.

This happened to me recently in a test upgrade to MySQL 5.5. That version deprecated some directives I had in /etc/my.cnf. Their presence caused mysqld to fail to start during the install of MySQL-server. This in turn caused a chicken-and-egg problem in getting the system tables upgraded properly.

Moving /etc/my.cnf out of the way during the upgrade will prevent those types of problems. After the upgrade you can put /etc/my.cnf back in place. This allows you to deal with directive deprecation in a safer manner.

3. Reinstalling Bundle::DBD::mysql should not be necessary. /scripts/mysqlup does this after installing MySQL.

4. You may also need to recompile the PHP binaries used by Apache (/scripts/easyapache). Especially is this true if you are changing MySQL versions (e.g. 4.1 -> 5.1)

5. I highly recommend that if you are simply wanting to change the MySQL version (4.1 -> 5.1) to use the MySQL Upgrade interface in WHM. This ui automates rebuilding of PHP, reinstalling the Ruby extensions, and many more things.

6. The URL for the cPanel MySQL RPMs is incorrect. The correct URL is http://httpupdate.cpanel.net/pub/mysqlinstall. This URL is only correct for cPanel & WHM version 11.28 and older. 11.30 and newer use a new system for retrieving the RPMs (still wrapped up in mysqlup tho).

Write a comment