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

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

10 Responses

  1. Kumar says:

    Hi Arun,

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

  2. DEEPAK says:

    How much time will it take to upgrade mysql ?

  3. Akhil Suresh says:

    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
    ====================

  4. Mo says:

    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?

  1. February 9, 2014

    […] How to enable remote MySQL for an IP address on a cPanel server via CSF How to upgrade MySQL from 5.1 to 5.5 in a cPanel server – command line option How to allow mysql client to access remote mysql […]

  2. February 9, 2014

    […] Related Links: How to replace MySQL with MariaDB on a cPanel server How to upgrade MySQL from 5.1 to 5.5 in a cPanel server – command line option […]

Leave a Reply

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