How to perform database user management

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 PostgreSQL.
  2. Click on the name of the cluster you need and then select the Users tab.

If you don't have Yandex.Cloud CLI, 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-postgresql user list
     --cluster-name=<cluster name>

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

Adding users

When adding a user, Managed Service for PostgreSQL reserves 50 connections to a PostgreSQL cluster (the connlimit parameter) by default. The minimum number of connections per user is 10.

Important

The total number of connections reserved for users must not exceed the value of the parameter max_connections. Keep in mind that Managed Service for PostgreSQL reserves 15 connections for service users per user PostgreSQL host. For example, if the cluster has the setting "max_connections": 100 you can reserve a maximum of 85 connections for cluster users.

  1. Go to the folder page and click Managed Service for PostgreSQL.
  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 Yandex.Cloud CLI, 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, run the command:

$ yc managed-postgresql user create <user name>
     --cluster-name=<cluster name>
     --password=<user password>
     --permissions=<list of DBs the user can access>

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

Updating users

For the user, you can change:

  • Name and password.
  • List of databases the user can access.
  • Limitation on the number of DB connections.

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 PostgreSQL.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click and select Change password.

If you don't have Yandex.Cloud CLI, 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, run:

$ yc managed-postgresql user update <user name>
     --cluster-name=<cluster name>
     --password=<user password>
     --permissions=<list of DBs the user can access>

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 PostgreSQL.
  2. Click on the name of the cluster you need and select the tab Users.
  3. Click and select Delete.

If you don't have Yandex.Cloud CLI, 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-postgresql user delete <user name>
     --cluster-name=<cluster name>

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