You can use Data Management (DMS) to manage PostgreSQL database accounts and their permissions, such as logging on to or creating databases.
Prerequisites
-
The database type is PostgreSQL or AnalyticDB for PostgreSQL.
A system role of Administrator, Database Administrator (DBA), or Regular User (Instance Owner)
-
You have the database account and database password for the destination database.
ImportantThe database account used to log on to the destination database must have the permission to create users.
Create a user
Log in to DMS 5.0.
-
Log on to the destination database. For more information, see Log on to a database.
-
On the home page, click the database instance in the navigation pane on the left. In the instance list, right-click the destination instance name and click Database Account Management.
-
On the Database Account Management page, click Create Database Account in the upper-left corner.
-
In the window that appears, configure the following parameters.
-
Click the Basic settings tab and configure the parameters.
Configuration Item
Description
User name
Enter the username for the account.
Password
Enter the logon password.
Confirm Password
Enter the logon password again.
Password Expiration Time
Select an expiration time for the password. For example, if you select 00:00 on December 30, 2021, the password expires at that time.
This parameter is optional and has no expiration by default.
Connection Limit
Enter the maximum number of concurrent connections for the account. For example, if you set this parameter to 10, the account can be used to connect to the database from up to 10 clients at the same time.
The default value is -1, which indicates no limit.
Remarks
Enter remarks for the account.
-
Click the Permissions tab and select the required permissions.
Permission Type
Description
Allow Logon
The logon permission. The corresponding SQL commands are
LOGINandNOLOGIN. By default, logon is allowed.Allow User Creation
The permission to create database accounts. The corresponding SQL commands are
CREATEROLEandNOCREATEROLE. By default, user creation is allowed.Allow DB Creation
The permission to create databases. The corresponding SQL commands are
CREATEDBandNOCREATEDB. By default, database creation is allowed.
-
Click Confirm.
In the Preview SQL Statement window, click Confirm.
NoteDatabase instances in Security Collaboration mode are subject to security rules. If the execution fails, follow the on-screen instructions or contact a DBA or an administrator for confirmation. For more information about how to adjust the rules, see the FAQ section.
Edit or delete an account
Use the edit feature to modify an account's username, password, global permissions, and object permissions.
Log in to DMS 5.0.
-
Click a database instance on the right side of the home page. In the instance list, right-click the target instance name and click Database Account Management.
-
Find the destination account and click Edit or Delete.