Creating a database user in cPanel

A database user is an application credential, not a cPanel login. Creating a separate user for each application makes it easier to control access and rotate one credential without disrupting unrelated sites.

Check access and requirements

Identify the database the application should use and the permissions required by its installer or documentation. Use a long unique generated password and store it securely. Do not put database credentials in a public text file or send them in an ordinary support message.

01 Create a database user in cPanel

  1. Open Manage My Databases, or MySQL Databases on an older cPanel layout. Find the section for creating a new database user.
  2. Enter the permitted username and a strong password. Create the user and record its full displayed name, including any hosting-account prefix.
  3. Use Add User to Database to select this user and the intended database. Grant the required privileges and save the assignment.
  4. Update the application’s database configuration with the new credential. If replacing an existing user, retain the old one until the new connection has been tested.
  5. When the transition is complete, remove unnecessary old privileges or credentials through cPanel.

Confirm the expected result

Perform a normal application read and a controlled write, such as saving a test setting. A user appearing in cPanel does not prove that it has been assigned to the correct database.

Why can the new database user not connect or run queries?

If authentication fails, check the full username and password first. If login succeeds but queries fail, review privileges and database selection. Keep database creation and user management in cPanel rather than phpMyAdmin so the panel retains correct ownership mapping.

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...

Assigning a database user and choosing its privileges in cPanel

A database user needs an explicit assignment to the database it will access. Privileges...

Diagnosing database access denied after a hosting migration

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