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:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- In the Username text box under Add New User, type the MySQL username.
- Type the user password in the Password text box.
- 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.
- 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:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- Locate the user for which you want to change the password under Current Users, and then click Change Password.
- 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.
- Click Change Password. The new password takes effect immediately.
Renaming a user
Please, follow these steps to rename a MySQL user:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- Locate the user that you want to rename under Current Users, and then click Rename.
- 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.
Please, follow these steps to delete a MySQL user:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- Locate the user that you want to delete under Current Users, and then click Delete.
- 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:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- In the New Database text box Under Create New Database, type the name of the database.
- 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:
- Log in to cPanel.
- Click MySQL® Databases In the DATABASES section of the cPanel home screen:
- In the User list box under Add User to Database, select the user that you want to add.
- Select the database In the Database list box.
- Click Add.
- 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.
- 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:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- To check a database:
- In the Check Database list box under Modify Databases, select the database.
- Click Check Database.
- 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:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- Locate the user for which you want to revoke privileges under Current Databases, and then click the trash can icon.
- 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.
Please, follow these steps to delete a MySQL database:
- Log in to cPanel.
- Click MySQL® Databases in the DATABASES section of the cPanel home screen:
- Locate the database that you want to delete under Current Databases, and then click Delete.
- 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