Managing MySQL Databases in cPanel: Maintenance, User Privileges, and Repair

In the MySQL Databases section of cPanel, you can manage existing databases, database users, and privileges. While the MySQL Database Wizard is ideal for initial setup, this overview provides greater control for maintenance, repairs, and later adjustments.

Typical tasks in this area include checking and repairing databases, assigning users, modifying privileges, and deleting databases or database users that are no longer needed.

Important Note: Use phpMyAdmin if you want to work inside a database, such as viewing tables, importing SQL files, or editing data. Databases, users, and user privileges, on the other hand, should be managed directly via the cPanel MySQL Databases tool to ensure the proper assignment to your hosting account.</div >

Database Maintenance: Checking and Repairing Databases

If your website responds slowly, displays database errors, or certain content stops loading correctly, checking or repairing the database can be helpful. cPanel provides built-in tools for this purpose.

Check Database
With this function, cPanel checks the tables of a database for potential errors or inconsistencies. This is useful if you suspect errors but are not yet sure whether a table is corrupted.
Repair Database
If errors were detected during the check, or if your website displays a message like "table is marked as crashed", cPanel can attempt to automatically repair the corrupted tables.

How to Check or Repair a Database

  1. Log in to cPanel.
  2. In the Databases section, open the MySQL Databases tool.
  3. Scroll down to Modify Databases or the section for maintenance functions.
  4. Select the desired database.
  5. Click on Check Database or Repair Database.
Recommendation: Create a backup whenever possible before performing repairs or major database changes. A repair often fixes minor table issues, but it does not replace a full data backup.

Managing Database Users and Privileges

For a website to access a database, it requires an appropriate database user with the necessary permissions. If this assignment is missing or the privileges are incomplete, database errors such as "Access denied" or "Error establishing a database connection" will frequently occur.

Adding a User to a Database

  1. Open the MySQL Databases section in cPanel.
  2. Scroll down to the Add User to Database section.
  3. Select the desired database user.
  4. Select the target database.
  5. Click Add.
  6. In the next window, select the required privileges.
  7. Save your selection.

For typical CMS and shop systems like WordPress, Joomla, Drupal, WooCommerce, or PrestaShop, ALL PRIVILEGES are usually required. This allows the application to create tables, as well as write, modify, delete, and query data.

Security Tip: Use a separate database user for each website whenever possible. This keeps access cleanly separated, and a compromised login won't automatically affect all databases on your hosting account.

Modifying or Restricting Privileges

In cPanel, you can adjust existing user privileges for a database. This is useful, for example, if a user should only have limited access or if permissions need to be added later.

For live websites, you should only change privileges if you know exactly what rights the respective application requires. If critical privileges are removed, the website may no longer be able to save content, perform updates, or execute table modifications.

Privilege Meaning Typical Use Case
SELECT Read data Querying and displaying content
INSERT Insert new data Saving posts, orders, or forms
UPDATE Modify existing data Updating settings, content, or user profiles
DELETE Delete data Removing content, comments, or temporary data
CREATE / ALTER / DROP Create, modify, or delete tables Installations, updates, and structural changes

Viewing Current Databases

In the Current Databases section, you can see your existing databases, their size, and assigned users. This overview helps you monitor disk space usage and identify which database belongs to which website.

If you run multiple websites under one hosting account, a clear naming structure is highly recommended. For example, use short, recognizable names like user_wpblog, user_shop, or user_forum.

Important: Database names and database users in cPanel often include a prefix consisting of your cPanel username. Always use the complete name in configuration files, for example, user_database instead of just database.

Renaming Databases

If your cPanel version supports renaming databases, proceed with extreme caution. Depending on the environment, a rename might be technically implemented by creating a new database, copying the tables, and removing the old database.

After renaming, you must update the new database name in your website's configuration file. In WordPress, for example, this affects the DB_NAME value in the wp-config.php file.

Before Renaming: Create a backup of the database and note down the current database name. Also, check which website or application is using this database.

Deleting Databases or Users

Databases and database users that are no longer needed can be deleted in cPanel. However, this step should only be taken if you are absolutely sure that the data is no longer required.

  • Delete Database: Removes the stored tables and content of the database. Create a backup beforehand if you might need the data later.
  • Delete Database User: Removes the user account access. The database itself usually remains intact but can no longer be accessed by this user.
  • Revoke User Assignment: Disconnects a user from a database without necessarily deleting the user or the database.
Warning: Deleting a live database can cause your website to stop functioning or lead to permanent data loss. Only delete databases after you have clearly verified their assignment.

Changing a Database User's Password

You can change a database user's password in cPanel. Keep in mind that your website will only continue to work if the new password is also updated in the respective configuration file.

For WordPress, the database password is located in the wp-config.php file under the DB_PASSWORD entry. If the password is changed in cPanel but not in the website configuration, a database connection error will usually appear.

Remote MySQL: External Database Access

If you want to access a database from an external server, a local development machine, or a program like MySQL Workbench, you may need authorization via Remote MySQL, depending on your hosting environment.

This typically involves whitelisting the external IP address from which the connection will be made. Without this authorization, access is usually blocked for security reasons.

  • Typical Use Case: Connecting from MySQL Workbench, a local development environment, or an external server.
  • Required: Whitelisting the external IP address in the Remote MySQL section, if this feature is available.
  • Additionally Needed: Correct database credentials and the appropriate hostname or server name.
Security Note: Only allow external database access for IP addresses you trust. Avoid wildcard permissions and remove remote access rules when they are no longer needed.

When to Use MySQL Databases and When to Use phpMyAdmin?

Task Recommended Tool
Create a database MySQL Databases or MySQL Database Wizard
Create a database user MySQL Databases
Manage user privileges MySQL Databases
View or edit tables phpMyAdmin
Import or export SQL files phpMyAdmin
Check or repair a database MySQL Databases

Summary

The MySQL Databases tool in cPanel is the central hub for managing your databases and database users. Here, you can check and repair databases, manage user privileges, change passwords, and remove databases or users that are no longer needed.

For working inside the database itself, such as editing tables or importing an SQL file, use phpMyAdmin instead.


Need assistance with a database repair, user assignment, or migration?
The CURIAWEB technical team will gladly help you with any questions regarding MySQL, MariaDB, and cPanel.

Open a Support Ticket

Was this answer helpful? 1 Users Found This Useful (1 Votes)