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

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.

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

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

Changing users

In the management console, you can only change the password of a database 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 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 <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.

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

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.