To add a new database user, send a POST request to /v2/databases/$DATABASE_ID/users
with the desired username.
Note: User management is not supported for Redis clusters.
When adding a user to a MySQL cluster, additional options can be configured in the
mysql_settings
object.
When adding a user to a Kafka cluster, additional options can be configured in
the settings
object.
The response will be a JSON object with a key called user
. The value of this will be an
object that contains the standard attributes associated with a database user including
its randomly generated password.
Name | Type | Required | Description | Default Value |
---|---|---|---|---|
database_cluster_uuid |
string | True | A unique identifier for a database cluster. | |
body |
JSON or IO[bytes] | True |
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
add_user_resp = client.databases.add_user(database_cluster_uuid="ab7bb7a", body={"name": "app-01"})
See the API spec for this endpoint to view additional detail on responses, headers, parameters, and more.