---
title: Database Users
url: https://docs.vultr.com/products/storage/databases/valkey/management/database-users
description: Learn how to create, modify, and manage user accounts for your Vultr Managed Database for Valkey instance.
publish_date: 2024-09-23T20:21:47.526667Z
last_updated: 2026-05-26T19:44:05.892357Z
---

# How to Manage Database Users for Vultr Managed Database for Valkey

Database users are accounts that connect and query managed databases, usually by specifying a username and a password. These accounts provide access control and prevent unauthorized access to your database. After creating a database user, you can define their privileges on the database level to fine-tune the database security.

Follow this guide to manage database users for Vultr Managed Databases for Valkey using the Vultr Console, API, CLI, or Terraform.

=== "Vultr Console"

    1. Navigate to **Products** and select **Databases**.
    1. Click the target database instance.
    1. Navigate to **Users** and click **Add New User**.
    1. Enter the username, define a strong password, and click **Create New User**.
    1. Click **Delete User** to remove the user from the database or click **Reset Password** to change the user's password.

=== "Vultr API"

    1. List all the database instances by sending a `GET` request to the [**List Managed Databases** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/list-databases) and note the database ID. For example, `43b4c774-5dff-4ac0-a01f-78a23c2205b5`.

        ```console
        $ curl "https://api.vultr.com/v2/databases" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `POST` request to the [**Create Database User* endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/create-database-user) specifying the database ID and the user credentials (`username` and `password`).

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/users" \
            -X POST \
            -H "Authorization: Bearer ${VULTR_API_KEY}" \
            -H "Content-Type: application/json" \
            --data '{
                "username" : "john_doe",
                "password" : "example_password"        
            }'
        ```

        Visit the [**Create Database User** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/create-database-user) to view additional attributes to add to your request.

    1. List the user details by sending a `GET` request to the [**Get Database User** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/get-database-user) and specify the database ID.

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/users" \
            -X GET \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

    1. Send a `DELETE` request to the [**Delete Database User** endpoint](https://www.vultr.com/api/#tag/managed-databases/operation/delete-database-user) specifying the database ID and the `username` to delete a user.

        ```console
        $ curl "https://api.vultr.com/v2/databases/database_id/users/username" \
            -X DELETE \
            -H "Authorization: Bearer ${VULTR_API_KEY}"
        ```

=== "Vultr CLI"

    1. List all database instances and note the database ID. For instance, `d6ac2a3c-92ea-43ef-8185-71a23e58ad8c`.

        ```console
        $ vultr-cli database list --summarize
        ```

    1. Add a new user by specifying a database ID, `username`, and `password`.

        ```console
        $ vultr-cli database user create database_id \
        --username john_doe \
        --password example_password    
        ```

    1. List all database users by specifying a database ID.

        ```console
        $ vultr-cli database user list database_id
        ```

    1. Delete a user from the database by specifying a database ID and a `username`.

        ```console
        $ vultr-cli database user delete database_id username
        ```

        Run `vultr-cli database user --help` to view all options.

=== "Terraform"

    1. Ensure the [Vultr Terraform provider](https://registry.terraform.io/providers/vultr/vultr/latest/docs) is configured.

    1. Create a database user with Terraform.

        ```terraform
        terraform {
            required_providers {
                vultr = {
                    source  = "vultr/vultr"
                    version = "~> 2.26"
                }
            }
        }

        provider "vultr" {}

        # Existing database assumed
        variable "database_id" { type = string }

        resource "vultr_database_user" "john" {
            database_id = var.database_id
            username    = "john_doe"
            password    = "example_password"
        }
        ```

    1. To delete the user, remove the resource block or run:

        ```console
        $ terraform destroy -target vultr_database_user.john
        ```
