doctl Verified current stable Not installed? Documentation

Doctl / Create Database User

Create Database User

Create a database user in DigitalOcean's Databases service.

$
Terminal
doctl databases user create <database_id> <user_name>

When To Use

When provisioning a new database user to limit access for security purposes.

Pro Tip

Use the `--no-wait` flag to return immediately without waiting for the request to complete, which can optimize long scripts.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
doctl databases user create <database_id> <user_name>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Creating database user...

User Details:
+----------------+------------------+
| User Name     | Status           |
+----------------+------------------+
| new_user      | Created          |
+----------------+------------------+

Database ID: db-123456
User ID: user-789012

Anatomy of Output

Understanding the result

User created with ID: user_123456 User ID

Identifier of the newly created user.

Username: user_name Username

The username provided during creation.

Status: active User Status

Current status of the database user.

Troubleshooting

Common pitfalls

Error creating user: Database not found.

Solution: Verify the database_id is correct.

Error: User already exists.

Solution: Choose a different username.

Error: Permission denied to create user.

Solution: Check permissions of the access token used.

Command Breakdown

What each part is doing

doctl
Base Command
The executable that performs this operation. Here it runs Doctl before the shell applies any redirect operators.
<database_id>
database id
The value supplied for database id.
<user_name>
user name
The user value supplied to this command.

How To Run

Execution path

  1. Step 1

    Run `doctl databases user create db-123456 new_user` to create the user.

  2. Step 2

    Verify user creation with `doctl databases user list db-123456`.

Alternative Approaches

Comparable commands in other tools

Alternative documentation tools for the same job.