How to upgrade MySQL from 5.1 to 5.5 in a cPanel server – command line option

MySQL is an open source RDBMS (Relational Database Management System) and its using the SQL Language(Structured Query Language). A database is a structured collection of data. SQL is the most commonly using language for database operations. By using SQL the database operations like adding, accessing and managing the database is very simple.

The MySQL upgrading steps is quite difficult normally. Like all software, the first steps for MySQL upgrade is taking the backup. Yes! it’s a very important step. In a cPanel installed server you can upgrade the MySQL verion from the command line itself by using the script “/scripts/check_cpanel_rpms”.

Here is short look for upgrading your MySql from 5.1 to 5.5 in a cPanel server.

1. Take the backup of all the databases on the server. Please refer How to create MySQL dump/backup of all the databases

2. Replace the MySQL version from 5.1 with 5.5 in /var/cpanel/cpanel.config file

#vi /var/cpanel/cpanel.config
and then, change 
-------
"mysql-version=5.1" to "mysql-version=5.5".
-------

3. Then, run

#/scripts/check_cpanel_rpms --fix

4. After executing this command, try

#mysql -V

MySQL will be upgraded to 5.5. Then try, php -v. You will get the following error:

-------------------
[email protected] [~]# php -v
php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
--------------------

Do an easyapache to fix this.

#/scripts/easyapache

Done!

Related topics:
How to create MySQL dump/backup of all the databases
reset mysql root password from command line Unix/linux

Post navigation

Arunlal Ashok

Linux Systems Architect at Endurance International Group. Linux lover. Like to play on Linux console. I started this blog to share and discuss Linux thoughts.

Always happy for an open discussion! Write to arun (@) crybit (dot) com. Check about me for more details. About this blog and our strong members, check The team CryBit.com

10 thoughts on “How to upgrade MySQL from 5.1 to 5.5 in a cPanel server – command line option

  1. Hi Arun,

    Is our database get deleted ?
    We are going to backup database for safety purpose or we have to restore it again ?

  2. Hi,

    Thank your Arun:-)

    while upgrading Mysql i got following error.

    ==============================
    20150512.022632] MySQL55-shared-5.5.42-2.cp1148
    [20150512.022633] W Error Code: 7
    [20150512.022633] E The following possible errors were detected while installing RPMs:
    [20150512.022633] E %pre(MySQL55-server-5.5.42-2.cp1148.x86_64) scriptlet failed, exit status 1 install
    [20150512.022633] The Administrator will be notified to review this output when this script completes
    [20150512.022633] Hooks system enabled.
    [20150512.022633] Checking for and running RPM::Versions ‘post’ hooks for any RPMs about to be installed
    warn [check_cpanel_rpms] program “/scripts/postmysqlinstall” is not executable
    warn [check_cpanel_rpms] program “/scripts/postmysqlup” is not executable
    [20150512.022633] All required ‘post’ hooks have been run
    ==============================

    I have fixed that above issue 😉

    This could have happened if the hostname was changed with MySQL running. You could stop MySQL and remove / move the PID file before upgrading MySQL again as Vanessa suggested. EX:

    =========================
    service mysql stop && rm -vi /var/lib/mysql/*.pid
    =========================

    Then again run the following command

    =====================
    /scripts/check_cpanel_rpms –fix
    ====================

  3. I tried this fix because in WHM upgrading is BLOCKED

    and now I do this I get this error

    [2016-05-04 22:36:07 +0300] file /usr/lib64/mysql/libmysqlclient_r.a from install of MySQL55-devel-5.5.49-1.cp1156.x86_64 conflicts with file from package MySQL-devel-percona-b18-5.0.84-0.rhel5.x86_64
    [2016-05-04 22:36:08 +0300] file /usr/share/man/man1/comp_err.1.gz from install of MySQL55-devel-5.5.49-1.cp1156.x86_64 conflicts with file from package MySQL-devel-percona-b18-5.0.84-0.rhel5.x86_64
    [2016-05-04 22:36:08 +0300] file /usr/share/man/man1/mysql_config.1.gz from install of MySQL55-devel-5.5.49-1.cp1156.x86_64 conflicts with file from package MySQL-devel-percona-b18-5.0.84-0.rhel5.x86_64
    [2016-05-04 22:36:08 +0300] W Error Code: 12

    what can I do now to fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *