Assigning a database user and choosing its privileges in cPanel

A database user needs an explicit assignment to the database it will access. Privileges determine whether it can read rows, change data or alter table structure. Granting access to one database does not need to expose every database in the hosting account.

What you need before you begin

Create the database and user first. Check the application’s required permissions and record the existing assignment before changing it. Installers and upgrades may need broader permissions than a read-only reporting tool.

01 Assign a database user and choose its privileges in cPanel

  1. Open Manage My Databases and find Add User to Database. Select the full user and database names, including their prefixes.
  2. Choose Add to open the privileges screen. Select the permissions required by this application and save with the displayed confirmation control.
  3. Use All Privileges only when the application genuinely requires full control of that database, such as an installer that creates and alters its own tables.
  4. For an existing assignment, open its privileges management action to review or change access. Do not remove permissions from a shared credential without checking every application that uses it.
  5. Update the application configuration if the username changed and test its relevant operations.

Confirm the expected result

Check both reading and saving data. A homepage that loads may not exercise the privileges needed for administration, scheduled jobs or an application update.

How do I distinguish a password error from missing database privileges?

An access-denied error can mean the wrong password, the wrong database or missing privileges. Distinguish authentication failure from a rejected SQL operation. If a change breaks the application, restore the previous known assignment while reviewing the minimum correct permissions instead of creating multiple unknown users.

Sources and further reading

  • 0 Users Found This Useful
  • cpanel-whm, development
Was this answer helpful?

Related Articles

Creating a MySQL or MariaDB database in cPanel

Create a database through cPanel so the hosting account owns and tracks it correctly. The...

Renaming a cPanel database without losing the application connection

Renaming a database changes the identifier an application uses to connect. It does not...

Deleting an unused database from cPanel

Delete a database only after confirming that no live website, staging site, scheduled task or...

Creating a database user in cPanel

A database user is an application credential, not a cPanel login. Creating a separate user for...

Diagnosing database access denied after a hosting migration

An access-denied database error after migration usually points to the connection identity,...