Learn cPanel

Controlling your Web Hosting Account has never been that easy thanks to cPanel web Control Panel!

• Last Updated: 01/15/2020
• ( 12 minutes reading )

How to manage your MySQL databases in cPanel?

Introduction

Today, nearly every website available on the World Wide Web is utilizing some sort of structured storage system, often called a database. The main use of this structured storage system is to store and retrieve information dynamically. The most used database system, at this point, is called MySQL. This is an open-source relational database management system, meant for managing SQL types of databases. It is supported and installed by default on all our Hosting Solutions, and every client can take advantage of it absolutely for free.

In the following lines of this tutorial, we will review the complete process of managing your MySQL databases using the cPanel control panel that comes for free with every web hosting package that we offer!

 

Accessing the MySQL Databases feature in cPanel

The very first thing you will need to do when talking about any of the features provided in cPanel is to actually login inside the web hosting control panel. If you are not familiar with how to do that, please check our other tutorial about How to access the cPanel service.

 

Assuming you have logged in, you should be able to see the main page of the cPanel service, it is time to locate the feature responsible for the management of your MySQL databases. It is located in the "Databases" section of features, and it is called "MySQL Databases".

 

manage-my-databases

 

Perfoming this action will redirect you to a brand new page designated for the complete management of the MySQL Databases located on your account, your MySQL Database Users, their User Privileges, and other useful databases-related functions, which we will discuss in detail in the following paragraphs. 

 

Create a New Database

The first thing you will see on the newly shown page should be a brief explanation of the "MySQL Databases" feature and the very first aspect of managing your MySQL Databases - creating a new database. Although we already explained in another tutorial How to Create a MySQL Database in cPanel, this is a completely different approach since it will only create a database without associating a user with it. Now, please go ahead and type the Database name into the provided input field. Once ready, please click on the "Create Database" button.

 

create-new-database

 

If there are no errors with the creation process, cPanel will provide you with a message that indicates the successful creation of your brand-new database. Please click the "Go back" link in order to return to the MySQL Databases page. 

 

Your brand new database will then be listed in the "Current Databases" section, which we will take a look at in a moment. 

 

Modify Databases

The next section, right after the "Create New Database" section, is the "Modify Databases" section. Although the name suggests that there will be some modifications applied to your MySQL databases this is more like a maintenance section that provides two actions that will improve the performance of your MySQL databases. Let's review the available actions:

 

  •  Check Database - Please select a database from the list of databases available from the dropdown. Performing this action will allow you to initiate a procedure that will check the selected database for errors. Once you select the correct database, please click on the "Check Database" button so the procedure can be initiated. When the check is complete, cPanel will present a full list of all the scanned tables in your database and will indicate the state of each table right next to it on the list.
  • Repair Database - This will be a consequence from the "Check Database" action. It will allow you to initiate a repair procedure for the selected database from the provided drop-down list. When the database you would like to repair is selected, please click on the "Repair Database" button so cPanel can initiate the procedure can be initiated. Once completed cPanel will provide you with an appropriate message indicating the result of the performed repair procedure.

 

modify-databases

 

It is useful if you can turn these Check and Repair actions into a routine, performed on a regular basis, since it will ensure that your databases are in their best condition. Healthy and well-performing databases translate into more happy website visitors, higher Google ranking, and consequently - higher revenue!

 

Current Databases

In this section, you can find a complete list of all the databases associated with your web hosting account. The information is conveniently structured in a table view consisting of 4 columns:

  • Database Name - This column will show the name of your database. Please notice that the complete name of your database is not only the one you have entered when creating the database. The database is also prefixed with the cPanel username. 
  • Size - This column will show the total size of your database. Please note that this size might vary from the size that you might see in phpMyAdmin.
  • Privileged Users - This column will show the privileged user assigned to your database. The specific database user has privileges to operate with the current database and perform different SQL statements on it.

 

current-databases

 

  • Available Actions with the database - As you might have already noticed, the only actions you can perform from this section with a database are to "Rename" the database and to "Delete" it.

Although we see no reason to explaining these actions, since they are pretty much self-explanatory, it is worth mentioning that deleting a database will delete not only the database itself but all the data stored in it. As for restoration options, please check with our Technical Support Team.

 

Add new MySQL User

The rest of the sections on this page are mainly going to focus on the MySQL database Users. 

 

So why do you need a MySQL user when communicating with your database? The simple answer is for security. If a database management system like MySQL had no authentication feature, then everyone could request and insert information into your database. This is not something you would want and should try to prevent at all costs. Therefore, to be able to communicate with each individual database, you will need to create a new database user and give that user the privileges you need on the database so they can execute queries.

 

Let's start by creating a new user. To do that, please scroll down to the "Add New User" section and fill out the "Username" and "Password" fields. Once done, please click on the "Create User" button located at the bottom of the section. 

 

add-new-database-user

 

If the user creation process is successful cPanel will redirect you to a new page that will display an appropriate status message. Now, please go back to the "MySQL Databases" main page by simply clicking on the "Go Back" button. 

 

As you might have already noticed, the database user names will follow the same naming convention as the MySQL databases. cPanel will put prefixes on the MySQL username with your cPanel username. Please note that this is the cPanel internal naming convention, and it cannot be avoided or changed. When configuring the database name and database username into your scripts, please use the complete name including the prefixed cPanel username. 

 

Add User to Database

The next section available for your Database Users is called "Add User To Database". Here you will be able to take a single but very important action - associating a database user with a database. To do that, you will have to follow 3 basic steps:

  1. Please choose a Database User from the "User" drop-down list.
  2. Please choose a Database Name from the "Database" drop-down list.
  3. Please click the "Add" button.

 

add-user-to-database

 

cPanel will understand the action you took and will redirect you to a brand new page. Remember the database privileges we have mentioned earlier? Well here is the place where you should set all those. 

 

At the top of the page, you will see the MySQL database User and the MySQL Database you are associating it with. Right after these, you will see all the available privileges conveniently structured in a table view. Please select the privileges your database user should have when operating with your MySQL database. If you are not certain which privileges should be chosen, simply click the "ALL PRIVILEGES" link at the top of the table so all the privileges can be granted to your MySQL user. 

 

manage-user-privileges

 

Finally, please click on the "Make Changes" button in order for the privileges configuration you have set to be preserved and the process of associating a user with a database to be completed. Now, please return to the "MySQL Databases" main page by simply clicking on the "Go Back" button. 

 

Current Users

The final section from the "MySQL Databases" feature is called "Current Users". Here you will find a complete list of all the MySQL users that you have created in your cPanel account either following this guide or our other tutorial on How to create MySQL Database via cPanel. The users will be contained in a two column table where the first column is the actual Username, and the second column being the available actions you can take for a respective username. 

 

current-users

 

Let's start by changing the password for a username. To do that, please find the username you would like to change the password for and simply click the "Change Password" link from the "Actions" column with features. 

 

current-users-change-password

 

This action will redirect you to a new page where you will simply need to fill out the new password and then click on the "Change Password" button. Once done, you should go back to the "MySQL Databases" page and scroll down to review the next action which is called "Rename". 

 

current-users-rename

 

This feature will allow you to rename a selected user. Please bear in mind, that when you rename a user you should ensure that you change the username in any script configuration file you have used the username previously. Avoiding that change might cause your website or scripts to produce an error related to the database connectivity. 

 

Finally to delete a MySQL User, simply use the "Delete" link located in the "Actions" column.

 

current-users-delete

 

You will be redirected to a new page where you will be asked to confirm the user's deletion. Please bear in mind that there is no option to restore deleted MySQL users apart from simply recreating the user. If you wonder what the previous password for the user was, we strongly suggest checking for any scripts utilizing that username for MySQL Database authentication since, most probably, you will be able to find the old password there. 

 

The process of managing your MySQL Databases in cPanel is pretty straightforward and we hope that this tutorial will help you to better understand it. Still, if you are feeling lost or do need some assistance in managing your cPanel Databases - our Technical Support team is 24/7/365 at your disposal.

...
Nikola Zgurev
Technical Support Captain

Nikola is an accomplished tech-savvy extraordinaire with over six years of experience in the web hosting field. He started as a customer care representative and quickly rose the ranks to become a support supervisor and, eventually - the head of the technical department in HostArmada. His deep understanding of the client's needs, combined with his technical knowledge, makes him the perfect man to create the ideal harmony between client satisfaction and professional problem-solving. You will often find him creating helpful tutorials, articles, and blog posts that help existing customers get around.