This topic describes how to create a database account for an AnalyticDB for PostgreSQL instance.
AnalyticDB for PostgreSQL provides the following types of database accounts:
- Privileged account: an account that has all permissions on all databases. The first account created for an instance in the console is a privileged instance.
- Standard accounts: accounts that have all permissions only on their authorized databases. Note Permissions include SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, and TRIGGER. For information about how to configure permissions, see Manage users and permissions.
- Before you use databases in an AnalyticDB for PostgreSQL instance , you must create a privileged account.
- Standard accounts cannot be created by using the console. For information about how to create standard accounts, see Execute SQL statements to create accounts.
- After you create a privileged account for an instance, you cannot delete the privileged account.
Create a privileged account
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select the region where the instance resides.
- Find the instance that you want to manage and click its ID.
- In the left-side navigation pane, click Account Management.
- Click Create Account.
- In the Create Account panel, specify the parameters described in the following table.
Parameter Description Account The name of the privileged account.
- The name can contain lowercase letters, digits, and underscores (_).
- The name must start with a lowercase letter and end with a lowercase letter or a digit.
- The name cannot start with gp.
- The name must be 2 to 16 characters in length.
New Password The password of the privileged account.
- The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
- The following special characters are supported:
! @ # $ % ^ & * ( ) _ + - =
- The password must be 8 to 32 characters in length.
Confirm Password Enter the password of the account again.
- Click OK.
Important After the account is created, you can click Reset Password in the Actions column to change the account password. To ensure data security, we recommend that you change your password on a regular basis and do not use passwords that you have used before.
Execute SQL statements to create accounts
- Create a privileged account.
CREATE ROLE <Account name> WITH LOGIN ENCRYPTED PASSWORD <Password> RDS_SUPERUSER;
CREATE role admin0 WITH LOGIN ENCRYPTED PASSWORD '111111' rds_superuser;
- Create a standard account.
CREATE ROLE <Account name> WITH LOGIN ENCRYPTED PASSWORD <'Password'>;
CREATE role test1 WITH LOGIN ENCRYPTED PASSWORD '111111';Note If you cannot access databases or tables by using the created standard account, you must execute a GRANT statement to grant permissions to the account. For more information, see GRANT.
|CreateAccount||Creates a privileged account.|
|DescribeAccounts||Queries the accounts created for an instance.|
|ModifyAccountDescription||Modifies the name of an account for an instance.|
|ResetAccountPassword||Resets the password of an account for an instance.|