How to manage MySQL databases and users in cPanel

Last modified: Thursday November 30th, 2023

In this article, you will learn about how to use cPanel to manage MySQL databases and users. The functionalities that you can perform include adding, altering, and removing databases and users. Additionally, you can handle the database permissions for users. Check out the cPanel-based web hosting from Beehosting https://beehosting.pro/shared-web-hosting-2/.

Managing database users

Before you can access MySQL databases, it is necessary to generate at least one user. The succeeding steps illustrate how to handle MySQL database users via cPanel.

Creating a database user

Please follow these steps to create a MySQL database user:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:         How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. In the Username text box under Add New User, type the MySQL username.
  4. Type the user password in the Password text box.
  5. Retype the user password in the Password (Again) text box.
    By clicking on “Password Generator,” cPanel will generate a robust and randomized password for you.
  6. Click Create User, and cPanel creates the database user.

Changing a user’s password

You have the option to change the password of a database user. This may be necessary for security purposes, as it is recommended to periodically update passwords for enhanced security, or it could be required if the password is forgotten.

Please follow these steps to change a MySQL user’s password:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:   How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. Locate the user for which you want to change the password under Current Users, and then click Change Password.
  4. type the new password in the Password and Password (Again) text boxes.
    By clicking on “Password Generator,” cPanel will generate a robust and randomized password for you.
  5. Click Change Password. The new password takes effect immediately.

Renaming a user

Please, follow these steps to rename a MySQL user:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. Locate the user that you want to rename under Current Users, and then click Rename.
  4. Type the new name in the New name text box, click Proceed, and cPanel renames the user.

Deleting a user

Deleting a user results in the removal of both the user and their corresponding database permissions.

Make sure you do not have any applications that currently use the database user!

Please, follow these steps to delete a MySQL user:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. Locate the user that you want to delete under Current Users, and then click Delete.
  4. Click Delete User to confirm the deletion.

Managing databases

Once you have created a database user, you can proceed to establish a database and link the user to the newly created database.

Creating a database

Please, follow these steps to create a MySQL database:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. In the New Database text box Under Create New Database, type the name of the database.
  4. Click Create Database, and cPanel creates the database.
    Upon creating a database, your username is added as a prefix to the database name. For instance, if your username is “username” and you create a database named “database,” the MySQL database name will be “username_database.”

Adding a user to a database

Please follow these steps to add a MySQL user to a database:

  1. Log in to cPanel.
  2. Click MySQL® Databases In the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. In the User list box under Add User to Database, select the user that you want to add.
  4. Select the database In the Database list box.
  5. Click Add.
  6. Select the check boxes to grant the user specific privileges, or select the ALL PRIVILEGES check box to grant the user all permissions to the database.
  7. Click Make Changes, and cPanel adds the user to the database.

Checking and repairing a database

It is possible to scan MySQL databases for errors or potential corruption, and if issues are detected, the database can be repaired accordingly.

Please, follow these steps to check and repair a database:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. To check a database:
    • In the Check Database list box under Modify Databases, select the database.
    • Click Check Database.
  4. In the event that a database check identifies issues with a database, you can proceed to fix it by repairing the database.
    • In the Repair Database list box Under Modify Databases, select the database.
    • Click Repair Database.

Revoking privileges from a database user

Revoking a database user’s privileges results in the user losing access to the database. To do this, follow these steps:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. Locate the user for which you want to revoke privileges under Current Databases, and then click the trash can How to manage MySQL databases and users in cPanel kb cpanel 78 databases delete icon icon.
  4. Click Revoke User Privileges from Database.

Deleting a database

Ensure that you have a backup copy of a database before deleting it if you wish to preserve any data within the database.

When you delete a database, any associated users are not deleted. However, all privileges users have for that database are revoked.

Please, follow these steps to delete a MySQL database:

  1. Log in to cPanel.
  2. Click MySQL® Databases in the DATABASES section of the cPanel home screen:How to manage MySQL databases and users in cPanel kb cpanel 78 databases mysql databases icon
  3. Locate the database that you want to delete under Current Databases, and then click Delete.
  4. Click Delete Database, and cPanel deletes the database.

More Information

If you need more information about MySQL, please visit http://www.mysql.com.

Looking for an outstanding cPanel-based web hosting provider? Try our web hosting packages with cPanel

Was this article helpful?
Views: 662

10 Years Beehosting!
Celebrate with 70% OFF + FREE Site Transfer.

Facebook Instagram linkedin

Beehosting.pro website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Menu