Upgrade MySQL to MySQL 5.1 in a Cpanel server

First ascertain the current version of mysql installed, the system architecture and OS release

rpm -qa|grep -i mysql
MySQL-devel-5.0.81-0.glibc23
MySQL-shared-5.0.81-0.glibc23
MySQL-client-5.0.81-0.glibc23
MySQL-server-5.0.81-0.glibc23
MySQL-bench-5.0.81-0.glibc23

arch
x86_64

cat /etc/redhat-release
CentOS release 5.3 (Final)

Next step is to download the latest MySQL 5.1 community release matching the OS and architecture from
http://dev.mysql.com/downloads/mysql/5.1.html#downloads


wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-server-community-5.1.35-0.rhel5.x86_64.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-client-community-5.1.35-0.rhel5.x86_64.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-shared-community-5.1.35-0.rhel5.x86_64.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-devel-community-5.1.35-0.rhel5.x86_64.rpm/from/http://mirror.csclub.uwaterloo.ca/mysql/

The download folder should look something like

ls
./ MySQL-client-community-5.1.35-0.rhel5.x86_64.rpm MySQL-server-community-5.1.35-0.rhel5.x86_64.rpm
../ MySQL-devel-community-5.1.35-0.rhel5.x86_64.rpm MySQL-shared-community-5.1.35-0.rhel5.x86_64.rpm

! FOLLOWING STEPS ARE VERY IMPORTANT

We must backup the current mysql setup as best as possible !.

cp -pvr /var/lib/mysql /var/lib/mysql.original.jun17
mysqldump --add-drop-database --all-databases > mysql.backup.jun17.sql

cp -p /etc/my.cnf /etc/my.cnf.original.jun17
cp -p /root/.my.cnf /root/.my.cnf.original.jun17
cp -p /etc/init.d/mysql /etc/init.d/mysql.original.jun17

Now we remove the current MySQL rpm’s

rpm -e MySQL-bench-5.0.81-0.glibc23
rpm -e MySQL-devel-5.0.81-0.glibc23
rpm -e MySQL-client-5.0.81-0.glibc23
rpm -e MySQL-server-5.0.81-0.glibc23
rpm -e MySQL-shared-5.0.81-0.glibc23

Install the new MySQL rpm’s

rpm -Uvh MySQL-server-community-5.1.35-0.rhel5.x86_64.rpm
rpm -Uvh MySQL-client-community-5.1.35-0.rhel5.x86_64.rpm
rpm -Uvh MySQL-shared-community-5.1.35-0.rhel5.x86_64.rpm
rpm -Uvh MySQL-devel-community-5.1.35-0.rhel5.x86_64.rpm

Copy over the original mysql init script

cp -p /etc/init.d/mysql /etc/init.d/mysql.bad
cp -p /etc/init.d/mysql.original.jun17 /etc/init.d/mysql

start mysql

/etc/init.d/mysql start

If there is a problem ,check the mysql error log for details

Run the following command to complete the mysql upgrade

mysql_upgrade

DESCRIPTION
mysql_upgrade should be executed each time you upgrade MySQL. It supersedes the older
mysql_fix_privilege_tables script, which should no longer be used.

mysql_upgrade checks all tables in all databases for incompatibilities with the current version of MySQL
Server. If a table is found to have a possible incompatibility, it is checked. If any problems are found,
the table is repaired. mysql_upgrade also upgrades the system tables so that you can take advantage of new
privileges or capabilities that might have been added.

Thats it.

Now your php mysql module is broken .So it is very important that you recompile either php alone or use easyapache3 to recompile apache and php with a forced rebuild of php !

Share and Enjoy:
  • Digg
  • Mixx
  • del.icio.us
  • StumbleUpon
  • Facebook
  • TwitThis
  • Technorati
  • Google

Tags:

2 Responses to “Upgrade MySQL to MySQL 5.1 in a Cpanel server”

  1. Daehee Says:

    What’s the easiest way to recompile php using this same environment?

  2. Upgrading Mysql - cPanel Forums Says:

    [...] might helps you to solve your issue: https://support.amhosting.com/index….cleid=74&nav=0 Upgrade MySQL to MySQL 5.1 in a Cpanel server | GNUSYS Knowledge Base __________________ Windows Hosting | Host Directory Cheapest Website Hosting | US [...]

Leave a Reply