How to manage 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 click 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 flag.

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

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

The cluster name can be requested with a list of folder clusters.

Adding users

  1. Go to the folder page and click 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 user name and password (from 8 to 128 characters).

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 flag.

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 <user name>
       --cluster-name <cluster name>
       --password <user password>
       --permission database=<DB name>,role=<role>,role=<another role>,...
       --permission database=<another DB name>,role=<role>,...
    

    The cluster name can be requested with a list of folder clusters.

Updating users

In the management console, you can only change the password of a database user:

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

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 flag.

To change the user's password or the list of databases available to the user:

  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 <user name>
       --cluster-name <cluster name>
       --password <user password>
       --permission database=<DB name>,role=<role>,role=<another role>,...
       --permission database=<another DB name>,role=<role>,...
    

    The cluster name can be requested with a list of folder clusters.

Removing a user

  1. Go to the folder page and click 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 flag.

To remove a user, run:

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

The cluster name can be requested with a list of folder clusters.