How to Upgrade MySQL on CentOS Updated on August 16, 2021 by InMotion Hosting Contributor 2 Minutes, 14 Seconds to Read This guide will go over how to upgrade the MySQL version on your dedicated server. This requires you to be logged into the server command line as the root user. Please follow all of the steps very carefully as you can easily corrupt your databases if this upgrade is not done properly. Also, please remember to keep updated backups of your databases prior to upgrading. NOTE: Root access is required to upgrade MySQL. Creating a Back Up & Upgrading Log into your server via SSH with the root user. Create a directory to store the backups and list the databases that have been backed up. mkdir /root/dbbackups; touch /root/dbbackups/list Next, backup the databases. It’s okay if you get a SELECT and LOCK error on certain tables relating to the schema databases. for db in $( mysql -e ‘show databases’ | grep -v “Database\|information_schema” | awk ‘{print $1}’ ) ; do mysqldump –add-drop-table $db > /root/dbbackups/$db.sql && echo $db >> /root/dbbackups/list; done Edit the /var/cpanel/cpanel.config file with your favorite editor (nano, vim, vi, etc). In this example, we’ll use vim vim /var/cpanel/cpanel.config Perform a search for mysql-version (default is around line 180) and edit it to the desired version. Save the file and run the following command for cPanel to upgrade or downgrade your MySQL version. /usr/local/cpanel/scripts/check_cpanel_rpms –fix Once the script is complete and there are no errors saying it failed, proceed to log into the MySQL command interface and you should see the following. In this tutorial we went from 5.6 to 5.5 in order to demonstrate mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 5.5.49-cll MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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. mysql> Just to be on the safe side you may want to repair the databases as a preventative measure. mysqlcheck -aR Also, you should run the following command to upgrade the system tables so there are no issues. mysql_upgrade If you need to restore the databases you have previously backed up then you can do so via the following command. for db in `cat /root/dbbackups/list` ; do mysql $db < /root/dbbackups/$db.sql ; done You can use EasyApache within WHM to recompile PHP, since it is usually necessary due to the MySQL changes 90% of the time. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles How to Create an Admin Account in WordPress via MySQL Setting up a Remote MySQL Database Connection How to Check and Repair a Database in phpMyAdmin Database Optimization: Tips Using MySQL Tuner Create a blank database How to Create a MySQL Database Using CLI & cPanel How to Connect to a Database with MySQL Workbench MySQL 1064 Error: You have an error in your SQL syntax Using MySQLi to INSERT Data into a Database How to get PostgreSQL on a VPS / Dedicated Server