Managing database users and privileges

Add users to a database, choose privileges, use separate users per application, and remove access you no longer need.

Guide2 min readLast updated
On this page
  1. Viewing users for a database
  2. Adding a user
  3. Choosing privileges
  4. Good practice
  5. Access denied errors
  6. If it doesn’t work
  7. Common questions

Each database can have one or more users, and each user needs privileges on the database to use it.

Viewing users for a database

Open Account Manager › MySQL Management and select the database. Its users are listed with their privileges.

Adding a user

  1. In the database’s page, choose to create a new user or add an existing one.
  2. Enter the user name and password, or pick an existing user.
  3. Choose privileges.
  4. Save.

Choosing privileges

UsePrivileges
A normal application (WordPress, most apps)All privileges on its own database
A reporting tool that only readsSELECT only
A migration toolAll, then remove the user when finished

Applications create and change tables during updates, so restricting a normal app’s privileges usually breaks updates.

Good practice

  • One user per application. If one app is compromised, the attacker can’t read the others’ databases.
  • Remove users you’ve finished with, such as temporary migration or developer accounts.
  • Never reuse database passwords elsewhere.

Access denied errors

Access denied for user 'acme_shop'@'localhost' means the name, password or privileges are wrong. Check the full prefixed user name, reset the password, and confirm the user is listed on the database. Database connection failed

Prefer to follow along?

Looking for somewhere to run PHP and MySQL? Traxio’s PHP and MySQL hosting includes phpMyAdmin.

If it doesn’t work

These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.

Common questions

What does “Access denied for user” mean?

The database username or password is wrong, or that user has no rights on that database. Check all three against DirectAdmin, remembering that database and usernames carry your account prefix — a missing prefix is the single most common cause.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going