In Data Management (DMS), you can manage users for PostgreSQL databases and user permissions on the databases.

Prerequisites

  • A native PostgreSQL or AnalyticDB for PostgreSQL database is used.
  • You are assigned a required role for the MySQL database instance that is registered in DMS. The role varies based on the control mode of the instance. The following table describes the details.
    Control mode Role requirement
    Security Collaboration You must be a DMS administrator, a database administrator (DBA), or the owner of the relevant database instance.
    Stable Change No specific role is required.
    Flexible Management No specific role is required.

Create a user

  1. Log on to the DMS console.
  2. On the Account Management page, click Create User in the upper-left corner.

    1. Click the Basic settings tab and set the parameters that are described in the following table.
      Create User dialog box
      Parameter Description
      User name The name of the user to be created.
      Password The password that the user can use to log on to the databases in the current instance.
      Confirm Password The password that the user can use to log on to the databases in the current instance. Enter the password again to confirm the password.
      Time When Password Expires The expiration time of the password. For example, set this parameter to Dec 30, 2021 00:00:00. Then, the password will expire at 00:00:00 on December 30, 2021.

      This parameter is optional. By default, the password does not expire.

      Connection Limit The maximum number of concurrent connections that the user can establish to the databases in the current instance. For example, set this parameter to 10, which indicates that the user can establish connections on up to 10 clients at the same time.

      The default value is -1, which indicates that the user can establish connections without limits.

      Remarks The description of the user.
    2. Click the Permission tab and select one or more permissions that you want to grant to the user.
      Permission Description
      Allow to Log On The permissions to log on to the databases in the current instance. DMS executes the LOGIN statement to grant the permissions or executes the NOLOGIN statement to revoke the permissions. By default, the user is allowed to log on to the databases.
      Allow to Create Users The permissions to create users for the databases in the current instance. DMS executes the CREATEROLE statement to grant the permissions or executes the NOCREATEROLE statement to revoke the permissions. By default, the user is allowed to create users.
      Allow to Create Databases The permissions to create databases for the current instance. DMS executes the CREATEDB statement to grant the permissions or executes the NOCREATEDB statement to revoke the permissions. By default, the user is allowed to create databases.
  3. In the Create User dialog box, click OK.
  4. In the Preview SQL Statement dialog box, click OK.
    Note If the database instance is in Security Collaboration mode, SQL statements can be generated based on the parameters you set. However, the SQL statements may fail to be executed due to security rules. In this case, you can perform operations as prompted or contact the DBA or DMS administrator.

Edit a user

  1. Log on to the DMS console.
  2. In the search box at the top of the left-side navigation pane, enter the name of the MySQL database whose permissions you want to manage. From the matched result, find the instance to which the database belongs.
  3. Right-click the instance and select Account Management.
  4. On the Account Management page, find the user whose information you want to edit and click Edit in the Operation column.
    Edit