Casbay Knowledge Base

Search our articles or browse by category below

HOW TO: Manage databases and database users in cPanel

Last modified: May 12, 2021
You are here:
Estimated reading time: 2 min

MANAGING DATABASES

Creating Database

To create a MySQL database, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen.
    2. Next, type the name of the database in the New Databasetext box under Create New Database.
    3. Lastly, click Create Database.

Adding a user to a database

To add a MySQL user to a database, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen.
    2. Under Add User to Database, select the user that you want to add in the User list box.
    3. In the Database list box, select the database.
    4. Then, click Add checkbox to grant the user specific privileges, or click the ALL PRIVILEGES checkbox to grant the user all permissions to the database.
    5. Lastly, click Make Changes.

Checking and repairing a database

However, you can check MySQL databases for errors or possible corruption. If a database check reveals problems, you can repair the database as well.

To check and repair a database, follow these steps:

    1. Firstly, click MySQL® Databases under the Databases section of the cPanel home screen.

    2. To check a database:
      • Under Modify Databases, select the database in the Check DB list box.
      • Click Check DB.
    3. If a database check indicates problems with a database, you can repair it:
      • Under Modify Databases, select the database in the Repair DB list box.
      • Click Repair DB.

Removing a user from a database

When you remove a user from a database, the user can no longer access the database.

To remove a MySQL user from a database, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen.
    2. Next, locate the user that you want to remove under Current Databases, and then click the red X icon.
    3. Lastly, click Delete User from Database to confirm the deletion.

Deleting a database

Before you delete a database, make sure that you have a backup copy if you want to save any information that it contains.

To delete a MySQL database, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen.
    2. Secondly, locate the database that you want to delete under Current Databases, and then click Delete Database.
    3. Lastly, click Delete Database to confirm the deletion.

MANAGING DATABASE USERS

To access MySQL databases, you must first create at least one user. The following procedures describe how to manage MySQL database users using cPanel.

Creating a database user

To create a MySQL database user, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen,.
    2. Under Add New User, type the MySQL username in the Username text box.
    3. Then, type the user password in the Password text box.
    4. In the Password (Again) text box, retype the user password.
    5. Lastly, click Create User.

Changing a user’s password

In other words, you can change a database user’s password. You may want to do this for security reasons (changing passwords periodically is a good security practice), or you may need to do this if you forget the password.

To change a MySQL user’s password, follow these steps:

    1. In the Databases section of the cPanel home screen, click MySQL® Databases.
    2. Next, locate the user for which you want to change the password under Current Users, and then click Set Password.
    3. In the Password and Password (Again) text boxes, type the new password.
    4. Lastly, click Change Password. The new password takes effect immediately.

Renaming a user

To rename a MySQL user, follow these steps:

    1. Firstly, click MySQL® Databases in the Databases section of the cPanel home screen.
    2. Then, locate the user that you want to rename under Current Users, and click Rename.
    3. In the text box, type the new name, and then click Proceed.

Deleting a user

When you delete a user, the user and its database permissions are deleted.

To delete a MySQL user, follow these steps:

    1. In the Databases section of the cPanel home screen, click MySQL® Databases.
    2. Next, locate the user that you want to delete under Current Users, and then click the red X icon.
    3. Lastly, click Delete User to confirm the deletion.

Check out the next article on HOW TO: disable directory browsing.

Was this article helpful?
Dislike 0
Views: 40