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

Upgrading or Downgrading MySQL

Posted by Vanessa | Tagged under , | Posted on December 28, 2009

8

Click here for instructions on manual upgrades

 

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. You may notice that in WHM > Tweak Settings, where MySQL upgrades and downgrades are usually done, you can no longer downgrade to versions under 5.0, nor (at the time of this writing) can you choose MySQL 5.1. Luckily cPanel gives you a way to get around this.

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, 4.0, 4.1, 5.0, or 5.1.

Then save the file. To perform the upgrade, you can run either of the following scripts:

/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

/scripts/mysqlup

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)

Word to the wise (and the lazy system admin that likes to gun through updates), you should ALWAYS dump all 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

Then to re-import after the upgrade/downgrade:

for db in `cat /root/dbbackups/list` ; do mysqldump $db < /root/dbbackups/$db.sql ; done

Notes:

  • If the MySQL upgrade fails, you can try a forced reinstall by doing /scripts/mysqlup –force
  • In my experience, downgrades to MySQL 4.0 from other versions isn’t always so smooth, and I’ve had to actually move out the entire /var/lib/mysql folder and do a complete reinstall of MySQL. This obviously will remove all the databases, but you may be able to manually move them back into the mysql folder and reimport from your backups
  • MySQL 4.0 is not automatically compatible with PHP 5+


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 (8)

[...] is set to ‘NO’, it means that you don’t have MySQL support and you need to either upgrade MySQL, or if you’re running a manually-compiled version, enable SSL [...]

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.

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.

[...] Upgrading or Downgrading MySQL [...]

[...] 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 [...]

[...] 17, 2011 in IT Admins 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 [...]

[...] Upgrading MySQL April 13th, 2011 No Comments 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 [...]

[...] 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 [...]

Write a comment