doctl Verified current stable Not installed? Documentation

Doctl / Delete Database User

Delete Database User

Delete a database user in DigitalOcean's Databases service.

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

When To Use

When a user accesses sensitive data incorrectly and needs removal.

Pro Tip

Add `--force` to bypass confirmation prompt for automated scripts.

Warning

Destructive operation. Confirm the target path and keep a backup before executing.

Command Builder

Tune the command before you copy it

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

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ doctl databases user delete 12345 john_doe

User 'john_doe' deleted successfully from database '12345'.

$ doctl databases user list 12345
+-----------+----------+-----------------+
| User ID   | Username | Role            |
+-----------+----------+-----------------+
| 67890     | jane_doe | read-only       |
+-----------+----------+-----------------+

Anatomy of Output

Understanding the result

User deleted: user_123456 Deleted User ID

ID of the deleted user for confirmation.

Remaining users: 3 User Count

Total users remaining after deletion.

Operation Status: success Operation Status

Indicates successful execution.

Troubleshooting

Common pitfalls

Error deleting user: User not found.

Solution: Check that the username and database_id are correct.

Error: Cannot delete user with ongoing connections.

Solution: Ensure all connections for this user are closed.

Error: Insufficient permissions.

Solution: Verify the access token used has admin privileges.

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 the command: `doctl databases user delete {{database_id}} {{user_name}}`

  2. Step 2

    Verify deletion with: `doctl databases user list {{database_id}}`

Alternative Approaches

Comparable commands in other tools

Alternative documentation tools for the same job.