Upgrading or Downgrading MySQL

Upgrading or Downgrading MySQL
4 (80%) 3 votes

Update 2/15/14:  These instructions have been updated for cPanel 11.36+.

You can easily change the major version of MySQL running on your server, keeping in mind that the actual version will be dependent on what cPanel has released in their repository and what cPanel version you’re running.  For example, if you’re running cPanel 11.40, you can’t downgrade to MySQL 5.0, or upgrade to MySQL 5.6 (which is provided in 11.42).  If you want an unsupported version and are feeling a little frisky, you can try the manual upgrade procedure.  If you’re lazy and/or are concerned about PHP breaking during the update (which it probably will, if you’re jumping between minor versions), we have a handy dandy upgrade script.

To change the MySQL version, edit the file /var/cpanel/cpanel.config and look for this line

mysql-version=

Then change the version number to the major version that you want to upgrade to. For instance, 5.1, 5.5.

Then save the file. To perform the upgrade, run:

/usr/local/cpanel/scripts/check_cpanel_rpms –fix

Then confirm the new version with the mysql -V command. In most cases, if you upgrade/downgrade between major versions you’ll break PHP if PHP is compiled with MySQL support. You may then have to re-run EasyApache to recompile PHP, which will automatically compile with the new libraries. You’ll know if this is necessary when you run the php -m command and get an error like this:

php: /usr/lib64/libmysqlclient.so.15: version `libmysqlclient_15' not found (required by php)

Or see this post on how to upgrade MySQL without breaking PHP.

Word to the wise (and the lazy system admin that likes to gun through updates), you should consider backing up your databases prior to upgrading/downgrading between major versions of MySQL. Here’s a command I use to dump all the databases on the server into a backup folder:

mkdir /root/dbbackups ; touch /root/dbbackups/list
for db in `mysql -e 'show databases' |awk '{print $1}'` ; do mysqldump --add-drop-table $db > /root/dbbackups/$db.sql && echo $db >> list ; done
;

 

 

zp8497586rq
Don't be selfish, share!Tweet about this on TwitterShare on RedditShare on TumblrBuffer this pageDigg thisShare on FacebookFlattr the authorEmail this to someoneShare on Google+Pin on PinterestPrint this pageShare on LinkedInShare on StumbleUpon

11 Comments

  1. Pingback: Installing an SSL Certificate for MySQL :: The cPanel Admin

  2. Chongo

    Just an FYI to everyone that is thinking of downgrading there MySQL in cPanel. This IS GOING TO BREAK A LOT OF STUFF!

    Ok, I said my piece.

    1. Vanessa

      Downgrading MySQL doesn’t usually break things – but as with any upgrade or downgrade, sites will break if they are not programmed to work outside specific versions.

  3. Pingback: Servers Admins » Blog Archive » Roundcube: MySQL or SQLite?

  4. Pingback: Manually Upgrading MySQL :: The cPanel Admin

  5. Pingback: Manually Upgrading MySQL | IT Admins

  6. Pingback: Manually Upgrading MySQL | TurboNoc.com

  7. Pingback: Manually Upgrading MySQL | TurboNoc

  8. Pingback: Restoring Database Privileges :: The cPanel Admin

  9. Pingback: Restoring Database Privileges « sanchezdiego.com.ar

  10. Pingback: Installing an SSL Certificate for MySQL

Log in