Database Users in CPanel

Database Users in CPanel

Database Users in CPanel

Introduction

A database alone isn’t enough to run your website — it needs a “user” linked to it with specific privileges to interact with its data. In this article, we explain how to create users, link them to databases, and why setting privileges correctly matters so much.

Why Do We Need a Separate User for Each Database?

Separating users from databases is a fundamental security principle. If one website on a shared hosting account gets compromised, the damage stays contained to that single database instead of spreading to every other database on the account.

Contact Us For More Details

Steps to Create a New User

  1. Go to the “MySQL Databases” section in cPanel.
  2. Scroll to “MySQL Users” and select “Add New User.”
  3. Enter a username and a strong password (you can use cPanel’s built-in password generator).
  4. Click “Create User.”

Linking the User to a Database

After creating the user, go to “Add User To Database,” select the user and the target database, then click “Add.”

Understanding Key Privilege Types

  • ALL PRIVILEGES: Grants the user full control over the database — ideal for a single website managed by one user.
  • SELECT: Allows read-only access without modifying data — useful for reporting or read-only accounts.
  • INSERT / UPDATE / DELETE: Separate privileges for adding, modifying, or deleting data — useful when you need fine-grained role control.

Security Best Practices

  • Avoid weak passwords or reusing passwords from other accounts.
  • Only grant “ALL PRIVILEGES” when truly necessary.
  • Periodically review your user list and delete any unused accounts.

Conclusion

Carefully configuring user privileges is your first line of defense in protecting your website’s data. In the next article, we’ll move on to actually working with the data inside your database using phpMyAdmin.

Frequently Asked Questions

Yes, the same user can be linked to multiple databases, each with independent privileges.

The connected website or application will immediately lose its database connection, so always confirm the account is no longer in use before deleting it.

No, changing the password doesn’t affect the data, but you’ll need to update your site’s configuration file (like wp-config.php) with the new password.