Database User Administration
Database users control access to your MySQL databases. Each user can be assigned specific privileges that determine what operations they can perform. Proper user management is important for both security and functionality.
Creating a Database User
A database user is typically created along with a new database. However, you can also create additional users:
- Log in to DirectAdmin and go to MySQL Databases.
- Click on the database you want to add a user to.
- Look for an option to Add User or Create User.
- Enter the username and password for the new user.
- Select the privileges to grant (see below).
- Click Create or Save.
Understanding Database Privileges
Common MySQL privileges include:
- SELECT - Read data from tables.
- INSERT - Add new rows to tables.
- UPDATE - Modify existing data in tables.
- DELETE - Remove rows from tables.
- CREATE - Create new tables and databases.
- DROP - Delete tables and databases.
- ALTER - Modify table structures (add/remove columns).
- INDEX - Create and remove indexes on tables.
- ALL PRIVILEGES - Grants all available privileges.
For most web applications like WordPress, the database user needs ALL PRIVILEGES on its database to function correctly, including for running updates and installing plugins.
Assigning a User to a Database
If you have created a user separately from a database, you need to link them:
- Go to MySQL Databases in DirectAdmin.
- Select the database.
- Choose the user from the available users list.
- Select the privileges to grant.
- Click Add User to Database or Save.
Changing a Database User Password
- Navigate to MySQL Databases.
- Find the user in the list and click Change Password (or click the user name).
- Enter and confirm the new password.
- Click Save.
After changing a database user's password, update the password in all applications that use that database user (e.g.,
wp-config.php for WordPress). Failing to do so will cause database connection errors on your website.