Sometimes you need more than one user account for a database, for example to give an application limited access or to let a developer connect without your main credentials. DirectAdmin lets you create additional MySQL users and assign them to a database. This guide explains how.
Why add another database user #
- Give an application its own dedicated credentials.
- Grant a developer access without sharing your main user.
- Limit permissions so each user has only what it needs.
Creating and assigning a user #
- Faça login no DirectAdmin.
- Ir para Account Manager > MySQL Management.
- Open the database you want to grant access to.
- Create a new user with a strong password, or select an existing one.
- Assign the user to the database and set the privileges it should have.
- Salvar.
Choosing privileges #
Grant only what is needed. A typical application user needs data privileges such as SELECT, INSERT, UPDATE, and DELETE, while administrative privileges should be limited. Keeping permissions minimal is good security practice.
Using the new credentials #
Note the database name, the new username, the password, and the host (usually localhost). Enter these into your application’s configuration so it connects with the new user.
Solução de problemas #
- Access denied: confirm the user is assigned to the database with the right privileges.
- App cannot connect: re-check the name, user, password, and host.
Precisa de ajuda? #
If a database user will not connect, our support team can help over live chat.