MySQL Upgrade


August 14, 2012 by harshalvaidya

MySQL Upgrade

First, check the current versions of MySQL, PHP, and Apache:

root@localhost ~ # mysql -V

root@localhost ~ # /usr/local/apache/bin/httpd -v

root@localhost ~ # php -v

root@localhost ~ # /usr/local/cpanel/bin/rebuild_phpconf –current
Let’s go ahead and check all of the databases, and note if there are any databases with errors:

for i in `mysql -BN -e “show databases”`; do mysqlcheck $i | grep -v OK; done;

After checking the databases, go ahead and run a repair:

for i in `mysql -BN -e “show databases”`; do mysqlcheck -r $i | grep -v OK; done;

Then check once more. Note any databases with errors or corruption:

for i in `mysql -BN -e “show databases”`; do mysqlcheck $i | grep -v OK; done;

Let’s go ahead and backup all of the databases:

root@localhost ~ # mkdir /home/upgrade_temp
root@localhost ~ # cd /home/upgrade_temp
root@localhost /home/upgrade_temp# for i in `mysql -BN -e “show databases”`; 

do mysqldump $i > $i.sql; cp -pvR /var/lib/mysql/$i /home/upgrade_temp/; done;

Check to make sure the databases are dumped and copied:

root@localhost /home/upgrade_temp # ll
total 964
-rw-r–r– 1 root root 4749 Dec 19 19:42 cphulkd.sql
-rw-r–r– 1 root root 783 Dec 19 19:42 Database.sql
-rw-r–r– 1 root root 34565 Dec 19 19:42 eximstats.sql
-rw-r–r– 1 root root 181121 Dec 19 19:42 horde.sql
-rw-r–r– 1 root root 1264 Dec 19 19:42 information_schema.sql
-rw-r–r– 1 root root 1902 Dec 19 19:42 leechprotect.sql
-rw-r–r– 1 root root 2911 Dec 19 19:42 modsec.sql
-rw-r–r– 1 root root 424398 Dec 19 19:42 mysql.sql
-rw-r–r– 1 root root 299110 Dec 19 19:42 roundcube.sql

Check/Remove the MySQL upgrade lock that might be in place, this might not exist currently:

root@localhost /home/upgrade_temp # rm -v /etc/mysqlupdisable

root@localhost /home/upgrade_temp # rm -v /etc/mysqldisable

Now, let’s upgrade MySQL.
Run /scripts/upcp first.

You will first need to specify which version of MySQL you are going to use by editing: /var/cpanel/cpanel.config

Look for this line:


You would change to to x.x,x.x or x.x, depending on which version you want. For this upgrade, we are using:


Save the file and run the upgrade:

root@localhost /home/upgrade_temp # /scripts/mysqlup –force

MySQL Setup Script Version 7.0
Loaded cPPkgs::MySQL ok!
This is the cPPkgs::MySQL x.x.x installer for Linux.
Fetching …………………….
Preparing……………………….–Install done
Install Complete.

Let’s make sure MySQL is running:

root@localhost ~ # mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Server version: 5.1.30 MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> status

mysql> quit
If you upgraded from MySQL x.x and MySQL fails to start:

root@localhost /home/upgrade_temp # /etc/init.d/mysql start
MySQL manager or server PID file could not be found! [FAILED]
Starting MySQLCouldn’t find MySQL manager or server [FAILED]

Make sure to remove or comment the following line from /etc/my.cnf:

# Basedir=/var/lib/mysql
Once this is completed you need check all of the databases for errors:

root@localhost /home/upgrade_temp # mysql_upgrade

This will check and update all sql databases. If the check fails, it will be repaired automatically at the end of the script.

Now that MySQL was upgrade you will need to recompile Apache/PHP to support the new MySQL version:

root@localhost ~ # /scripts/easyapache

Make sure to check under PHP4/PHP5 that MySQL of the system support is enabled.

Once the recompile is completed, check the versions:

root@localhost ~ # mysql -V

root@localhost ~ # /usr/local/apache/bin/httpd -v

root@localhost ~ # php -v

root@localhost ~ # /usr/local/cpanel/bin/rebuild_phpconf –current

Now, there is one last task: Rebuilding cPanel’s PHP interpreter to take advantage of the new libraries:


This will take a while. Once it’s finished, verify that PHPMyAdmin? loads. And all is set 😉


2 thoughts on “MySQL Upgrade

  1. […] MySQL Upgrade MySQL Upgrade […]

  2. Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. WordPress Seo Plugin

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats

  • 773 hits


var infolink_pid = 1084591; var infolink_wsid = 0;
%d bloggers like this: