Upgrade MySQL in cPanel via Command Line ( SSH )

Upgrade MySQL in cPanel
This article will help you to know how to upgrade MySQL in cPanel via command line.

Do you have the old 5.1 version MySQL in your cPanel? cPanel offers 5.5 version MySQL, and if you think your databases are MySQL 5.5 compatible, you can follow the below methods to upgrade the MySQL version in cPanel.

This script “/scripts/check_cpanel_rpms” in cPanel will check and fix the RPM issues. When executed, it will check and compare the cPanel compatible RMP’s installed with the main cPanel RPM located “/var/cpanel/cpanel.config”. Let’s do a simple trick with this script to upgrade MySQL.

 

Upgrade MySQL in cPanel – Easy Method

Note: This is a safe method that I found and tested successfully. But still, take the backup and execute it at your own risk.

The method is simple. In the main cPanel configuration file, the MySQL version must be specified as 5.1 ( mysql-version=5.1 ). Let’s change that to 5.5 and run the “/scripts/check_cpanel_rpms –fix”, so the script will check the cPanel configuration file and find that the 5.5 packages are not installed. It will remove the old 5.1 packages and will install the 5.5.

Please find the steps and logs below.

See the MySQL version and info.

root# mysql
Welcome to the MySQL monitor. Commands end with ; or g. 
Your MySQL connection id is 3949 
Server version: 5.1.70-cll MySQL Community Server (GPL) 
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. 
Reading history-file /root/.mysql_history 
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

 

Now replace the 5.1 MySQl version with 5.5 in “/var/cpanel/cpanel.config”

root# sed -i 's/mysql-version=5.1/mysql-version=5.5/g' /var/cpanel/cpanel.config

 

Execute the script “/scripts/check_cpanel_rpms –fix”

root# /scripts/check_cpanel_rpms --fix
[20131110.094525] 
[20131110.094525] Problems were detected with cPanel-provided files which are RPM controlled. 
[20131110.094525] If you did not make these changes intentionally, you can correct them by running: 
[20131110.094525] 
[20131110.094525] > /usr/local/cpanel/scripts/check_cpanel_rpms --fix
[20131110.094525] The following RPMs are missing from your system:
[20131110.094525] MySQL55-client-5.5.32-1.cp1136
[20131110.094525] MySQL55-devel-5.5.32-1.cp1136
[20131110.094525] MySQL55-server-5.5.32-1.cp1136
[20131110.094525] MySQL55-shared-5.5.32-1.cp1136
[20131110.094525] MySQL55-test-5.5.32-1.cp1136
[20131110.094526] 
[20131110.094526] The following RPMs are unneeded on your system and should be uninstalled:
[20131110.094526] MySQL51-client-5.1.70-1.cp1136
[20131110.094526] MySQL51-devel-5.1.70-1.cp1136
[20131110.094526] MySQL51-server-5.1.70-1.cp1136
[20131110.094526] MySQL51-shared-5.1.70-1.cp1136
[20131110.094526] MySQL51-test-5.1.70-1.cp1136
[20131110.094751] Removing 0 broken rpms: 
[20131110.094751] rpm: no packages given for erase
[20131110.094752] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/rpm.md5
[20131110.094753] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/MySQL55-client-5.5.32-1.cp1136.x86_64.rpm
[20131110.094753] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/MySQL55-devel-5.5.32-1.cp1136.x86_64.rpm
[20131110.094753] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/MySQL55-server-5.5.32-1.cp1136.x86_64.rpm
[20131110.094754] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/MySQL55-shared-5.5.32-1.cp1136.x86_64.rpm
[20131110.094754] Downloading http://httpupdate.cpanel.net/RPM/11.36/centos/6/x86_64/MySQL55-test-5.5.32-1.cp1136.x86_64.rpm
[20131110.094755] Hooks system enabled
[20131110.094755] Checking for and running RPM::Versions 'pre' hooks for any RPMs about to be installed
warn [check_cpanel_rpms] program "/scripts/premysqlup" is not executable
[20131110.094755] All required 'pre' hooks have been run
[20131110.094756] Uninstalling unneeded rpms: MySQL51-devel MySQL51-test MySQL51-client MySQL51-shared MySQL51-server
[20131110.094813] Shutting down MySQL... SUCCESS! 
[20131110.094817] Installing new rpms: MySQL55-client-5.5.32-1.cp1136.x86_64.rpm MySQL55-devel-5.5.32-1.cp1136.x86_64.rpm MySQL55-server-5.5.32-1.cp1136.x86_64.rpm MySQL55-shared-5.5.32-1.cp1136.x86_64.rpm MySQL55-test-5.5.32-1.cp1136.x86_64.rpm
[20131110.094817] Preparing packages for installation...
[20131110.094818] MySQL55-client-5.5.32-1.cp1136
[20131110.094822] MySQL55-server-5.5.32-1.cp1136
[20131110.094827] ERROR: 1136 Column count doesn't match value count at row 1
[20131110.094827] 131110 9:48:27 [ERROR] Aborting
[20131110.094827] 
[20131110.094827] 131110 9:48:27 [Note] /usr/sbin/mysqld: Shutdown complete
[20131110.094827] 
[20131110.094827] 
[20131110.094827] Installation of system tables failed! Examine the logs in
[20131110.094827] /var/lib/mysql for more information.
[20131110.094827] 
[20131110.094827] You can try to start the mysqld daemon with:
[20131110.094827] 
[20131110.094827] shell> /usr/sbin/mysqld --skip-grant &
[20131110.094827] 
[20131110.094827] and use the command line tool /usr/bin/mysql
[20131110.094827] to connect to the mysql database and look at the grant tables:
[20131110.094827] 
[20131110.094827] shell> /usr/bin/mysql -u root mysql
[20131110.094827] mysql> show tables
[20131110.094827] 
[20131110.094827] Try 'mysqld --help' if you have problems with paths. Using --log
[20131110.094827] gives you a log in /var/lib/mysql that may be helpful.
[20131110.094827] 
[20131110.094827] Please consult the MySQL manual section
[20131110.094827] 'Problems running mysql_install_db', and the manual section that
[20131110.094827] describes problems on your OS. Another information source are the
[20131110.094827] MySQL email archives available at http://lists.mysql.com/.
[20131110.094827] 
[20131110.094827] Please check all of the above before mailing us! And remember, if
[20131110.094827] you do mail us, you MUST use the /usr/bin/mysqlbug script!
[20131110.094827] 
[20131110.094833] Looking for 'mysql' as: /usr/bin/mysql
[20131110.094833] Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
[20131110.094833] Running 'mysqlcheck with default connection arguments
[20131110.094833] Running 'mysqlcheck with default connection arguments
[20131110.094833] cphulkd.auths OK
[20131110.094833] cphulkd.blacklist OK
[20131110.094833] cphulkd.brutes OK
[20131110.094833] cphulkd.good_logins OK
[20131110.094833] cphulkd.logins OK
[20131110.094833] cphulkd.report OK
[20131110.094833] cphulkd.whitelist OK
[20131110.094833] eximstats.defers OK
[20131110.094833] eximstats.failures OK
[20131110.094833] eximstats.sends OK
[20131110.094833] eximstats.smtp OK
[20131110.094833] horde.horde_alarms OK
[20131110.094833] horde.horde_cache OK
[20131110.094833] horde.horde_datatree OK
[20131110.094833] horde.horde_datatree_attributes OK
[20131110.094833] horde.horde_groups OK
[20131110.094833] horde.horde_groups_members OK
[20131110.094833] horde.horde_histories OK
[20131110.094833] horde.horde_locks OK
[20131110.094833] horde.horde_perms OK
[20131110.094833] horde.horde_prefs OK
[20131110.094833] horde.horde_sessionhandler OK
[20131110.094833] horde.horde_signups OK
[20131110.094833] horde.horde_syncml_anchors OK
[20131110.094833] horde.horde_syncml_map OK
[20131110.094833] horde.horde_tokens OK
[20131110.094833] horde.horde_users OK
[20131110.094833] horde.horde_vfs OK
[20131110.094833] horde.imp_sentmail OK
[20131110.094833] horde.ingo_forwards OK
[20131110.094833] horde.ingo_lists OK
[20131110.094833] horde.ingo_rules OK
[20131110.094833] horde.ingo_shares OK
[20131110.094833] horde.ingo_shares_groups OK
[20131110.094833] horde.ingo_shares_users OK
[20131110.094833] horde.ingo_spam OK
[20131110.094833] horde.ingo_vacations OK
[20131110.094833] horde.kronolith_events OK
[20131110.094833] horde.kronolith_shares OK
[20131110.094833] horde.kronolith_shares_groups OK
[20131110.094833] horde.kronolith_shares_users OK
[20131110.094833] horde.kronolith_storage OK
[20131110.094833] horde.mnemo_memos OK
[20131110.094833] horde.mnemo_shares OK
[20131110.094833] horde.mnemo_shares_groups OK
[20131110.094833] horde.mnemo_shares_users OK
[20131110.094833] horde.nag_shares OK
[20131110.094833] horde.nag_shares_groups OK
[20131110.094833] horde.nag_shares_users OK
[20131110.094833] horde.nag_tasks OK
[20131110.094833] horde.turba_objects OK
[20131110.094833] horde.turba_shares OK
[20131110.094833] horde.turba_shares_groups OK
[20131110.094833] horde.turba_shares_users OK
[20131110.094833] leechprotect.hits OK
[20131110.094833] logaholicDB_vps_1111842_12395._logaholic_GlobalSettings OK
[20131110.094833] logaholicDB_vps_1111842_12395._logaholic_Profile_URL_Params OK
[20131110.094833] logaholicDB_vps_1111842_12395._logaholic_Profiles OK
[20131110.094833] logaholicDB_vps_1111842_12395._logaholic_Traffic_Sources OK
[20131110.094833] logaholicDB_vps_1111842_12395._logaholic_users OK
[20131110.094833] logaholicDB_vps_1111842_12395._user_Agents OK
[20131110.094833] logaholicDB_vps_1111842_12395.lgstatus OK
[20131110.094833] logaholicDB_vps_1111842_12395.notes OK
[20131110.094833] mysql.columns_priv OK
[20131110.094833] mysql.db OK
[20131110.094833] mysql.event OK
[20131110.094833] mysql.func OK
[20131110.094833] mysql.general_log OK
[20131110.094833] mysql.help_category OK
[20131110.094833] mysql.help_keyword OK
[20131110.094833] mysql.help_relation OK
[20131110.094833] mysql.help_topic OK
[20131110.094833] mysql.host OK
[20131110.094833] mysql.ndb_binlog_index OK
[20131110.094833] mysql.plugin OK
[20131110.094833] mysql.proc OK
[20131110.094833] mysql.procs_priv OK
[20131110.094833] mysql.proxies_priv OK
[20131110.094833] mysql.servers OK
[20131110.094833] mysql.slow_log OK
[20131110.094833] mysql.tables_priv OK
[20131110.094833] mysql.time_zone OK
[20131110.094833] mysql.time_zone_leap_second OK
[20131110.094833] mysql.time_zone_name OK
[20131110.094833] mysql.time_zone_transition OK
[20131110.094833] mysql.time_zone_transition_type OK
[20131110.094833] mysql.user OK
[20131110.094833] roundcube.cache OK
[20131110.094833] roundcube.cache_index OK
[20131110.094833] roundcube.cache_messages OK
[20131110.094833] roundcube.cache_thread OK
[20131110.094833] roundcube.contactgroupmembers OK
[20131110.094833] roundcube.contactgroups OK
[20131110.094833] roundcube.contacts OK
[20131110.094833] roundcube.cp_schema_version OK
[20131110.094833] roundcube.dictionary OK
[20131110.094833] roundcube.identities OK
[20131110.094833] roundcube.searches OK
[20131110.094833] roundcube.session OK
[20131110.094833] roundcube.system OK
[20131110.094833] roundcube.users OK
[20131110.094833] Running 'mysql_fix_privilege_tables'...
[20131110.094833] OK
[20131110.094834] Starting MySQL SUCCESS! 
[20131110.094834] MySQL55-test-5.5.32-1.cp1136
[20131110.094847] MySQL55-shared-5.5.32-1.cp1136
[20131110.094847] MySQL55-devel-5.5.32-1.cp1136
[20131110.094847] Prelinking is disabled.
[20131110.094847] Checking for and running RPM::Versions 'post' hooks for any RPMs just installed
warn [check_cpanel_rpms] program "/scripts/postmysqlinstall" is not executable
warn [check_cpanel_rpms] program "/scripts/postmysqlup" is not executable
[20131110.094847] All required 'post' hooks have been run

 

Now run the “mysql” command again to see the changes.

root# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.5.32-cll MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

 

That will Upgrade MySQL in cPanel to the mentioned version.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

cPanel & WHM Management Services

Focus on your business, and let us take care of your cPanel Servers!
From what you are reading, it seems you are interested in cPanel/WHM and related technologies. If you have a moment to spare, please take a look at our cPanel Management Services plan, and which might interest you even more!
cPanel Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

Introducing - WPHealers!

Complete WordPress Management, 24x7 Support & White Label Agency Plans!

WordPress migration service, security, white-label reseller services and lot more! Grab the introductory deals now!

WPHealers

ServerHealers uses cookies.