doctl Verified current stable Not installed? Cloud Infrastructure

Doctl / Retrieve List Of Database Users

Retrieve List Of Database Users

List all users associated with a specified database.

$
Terminal
doctl d u ls <database_id>

When To Use

During security review and access control configurations.

Pro Tip

Leverage output formatting to align with auditing frameworks and compliance regulations.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
doctl d u ls <database_id>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
ID          Name          Role
--------------------------------
1           alice         admin
2           bob           read-only
3           charlie       read-write
4           dave          read-only

Anatomy of Output

Understanding the result

Users for Database ID: DB-001 Database ID

Header indicating the database in question.

1. db_admin User Name

Administrative user with full privileges.

2. db_user User Name

Standard user with limited privileges.

3. guest_user User Name

Guest account with minimal access.

Power User Variants

Optimized versions

doctl databases user list 12345 --format=json

Output user list in JSON format.

doctl databases user list 67890 --verbose

Get the complete user list with additional output details.

Troubleshooting

Common pitfalls

Error: No users found for specified database

Solution: Confirm that user accounts exist for the provided database ID.

Error: Database ID invalid

Solution: Recheck the database ID, ensuring it is accurate.

Error: Unauthorized access

Solution: Ensure your API token has permissions to view user list.

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.
d
d|databases
The value supplied for d|databases.
u
u|user
The user value supplied to this command.
ls
ls|list
The value supplied for ls|list.
<database_id>
database id
The value supplied for database id.

How To Run

Execution path

  1. Step 1

    Run `doctl databases user list <database_id>` to retrieve users.

  2. Step 2

    Review the output for user roles and access levels.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.