Database Users
Manage logical databases and user accounts for your Managed Database services. Users can be granted specific permissions and access controls.
Logical database and user management is available for MySQL and PostgreSQL services.
List logical databases
Returns a list of logical databases in a Managed Database service. Available for MySQL and PostgreSQL.
Request
curl -X GET https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/databases \
-u your_username:your_password
Create logical database
Creates a new logical database in a Managed Database service.
Attributes
- Name
name- Type
- string
- Description
Database name (1-64 chars). Required.
- Name
lc_collate- Type
- string
- Description
Locale collation. Default: "en_US.UTF-8". PostgreSQL only.
- Name
lc_ctype- Type
- string
- Description
Locale character type. Default: "en_US.UTF-8". PostgreSQL only.
Request
curl -X POST https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/databases \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"name": "myapp_db"
}'
Delete logical database
Deletes a logical database from a Managed Database service.
Request
curl -X DELETE https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/databases/myapp_db \
-u your_username:your_password
List users
Returns a list of users in a Managed Database service.
Request
curl -X GET https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users \
-u your_username:your_password
Get user details
Returns details about a specific database user.
Request
curl -X GET https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users/app_user \
-u your_username:your_password
Create user
Creates a new user in a Managed Database service.
Attributes
- Name
username- Type
- string
- Description
Username (1-64 chars). Required.
- Name
password- Type
- string
- Description
User password. If not provided, one will be generated.
- Name
authentication- Type
- string
- Description
Authentication method. MySQL: "mysql_native_password" or "caching_sha2_password".
Request
curl -X POST https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"username": "app_user",
"password": "SecurePassword123!",
"authentication": "caching_sha2_password"
}'
Modify user
Modifies a database user's password or authentication method.
Attributes
- Name
password- Type
- string
- Description
New password for the user.
- Name
authentication- Type
- string
- Description
Authentication method.
Request
curl -X PATCH https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users/app_user \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"password": "NewSecurePassword456!"
}'
Modify user access control
Modifies access control settings for a database user. Available for Valkey/Redis.
Attributes
- Name
categories- Type
- array
- Description
Command categories allowed. Example: ["+@all"].
- Name
commands- Type
- array
- Description
Specific commands allowed or denied.
- Name
keys- Type
- array
- Description
Key patterns user can access.
- Name
channels- Type
- array
- Description
Pub/Sub channels user can access.
Request
curl -X PUT https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users/app_user/access-control \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"categories": ["+@all", "-@dangerous"],
"commands": ["-FLUSHALL", "-FLUSHDB"],
"keys": ["app:*", "cache:*"],
"channels": ["notifications:*"]
}'
Delete user
Deletes a database user. The primary admin user cannot be deleted.
Request
curl -X DELETE https://api.upcloud.com/1.3/database/09a4b9d5-c1f8-4c9f-9e7a-1234567890ab/users/app_user \
-u your_username:your_password