Managing database users

You can add and remove users, as well as manage their individual settings.

Getting a list of users

  1. Go to the folder page and select Managed Service for MongoDB.
  2. Click on the name of the cluster you need and then select the Users tab.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To get a list of cluster users, run the command:

$ yc managed-mongodb user list
     --cluster-name <cluster name>

You can query the cluster name with the list of clusters in the folder.

To get a list of users, use the list method.

Add a user

  1. Go to the folder page and select Managed Service for MongoDB.

  2. Click on the name of the cluster you need and select the tab Users.

  3. Click Add.

  4. Enter the database username and password (from 8 to 128 characters).

  5. Configure the roles for the user:

    1. Select the database where you want to grant a role.
    2. Select the role and click Add under the list of roles.

    You can grant multiple roles to a user in different databases.

  6. Click Add.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To create a user in a cluster:

  1. See the description of the CLI's create user command:

    $ yc managed-mongodb user create --help
    
  2. Specify the user properties in the create command:

    $ yc managed-mongodb user create <username>
       --cluster-name <cluster name>
       --password <user password>
       --permission database=<DB name>,role=<role>,role=<another role>,...
       --permission database=<another DB name>,role=<role>,...
    

    You can query the cluster name with the list of clusters in the folder.

You can add users using the create method.

Changing users

  1. Go to the folder page and select Managed Service for MongoDB.
  2. Click on the name of the cluster you need and select the tab Users.
  3. To change the user's password, click image and select Change password.
  4. To change the user's roles:
    1. Click image, and select Configure.
    2. To add a role, select the database and role, then click Add under the list of roles.
    3. To delete a role, click image next to the role.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To change a user's password or list of roles:

  1. See the description of the CLI's update user command:

    $ yc managed-mongodb user update --help
    
  2. Specify the user properties in the create command:

    $ yc managed-mongodb user update <username>
       --cluster-name <cluster name>
       --password <user password>
       --permission database=<DB name>,role=<role>,role=<another role>,...
       --permission database=<another DB name>,role=<role>,...
    

    You can query the cluster name with the list of clusters in the folder.

To edit the user's data, use the update method.

Deleting users

  1. Go to the folder page and select Managed Service for MongoDB.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click image, and select Delete.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To remove a user, run:

$ yc managed-mongodb user delete <username>
     --cluster-name <cluster name>

You can query the cluster name with the list of clusters in the folder.

You can delete a user using the delete method.