This topic describes how to create a database account and reset its password on an AnalyticDB for PostgreSQL instance.

Background information

AnalyticDB for PostgreSQL provides two types of database accounts: privileged accounts and standard accounts.

  • Privileged accounts have all permissions on all databases.
  • Standard accounts have all permissions only on their authorized databases.
For more information about permission management, see Manage users and permissions.

Before you use AnalyticDB for PostgreSQL, you must create an initial account on an instance to connect to the instance. You cannot use the console to create other accounts. However, you can connect to the instance and execute SQL statements to create other accounts. For more information, see Execute SQL statements to create accounts.

Create an initial account

  • After an initial account is created, it cannot be deleted.
  • The initial account is a privileged account.
  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the top navigation bar, select the region where your AnalyticDB for PostgreSQL instance resides.
  3. Find your AnalyticDB for PostgreSQL instance and click its ID.
  4. In the left-side navigation pane, click Account Management.
  5. On the page that appears, click Create Account.
  6. In the panel that appears, enter the database account and password, and click OK.
    • The account name must be 2 to 16 characters in length, and can contain lowercase letters, digits, and underscores (_). It must start with a lowercase letter and end with a lowercase letter or digit. Example: user4example.
    • The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
    • Confirm the password and make sure that you enter the correct password.
    Note You can click Reset Password in the Action column corresponding to a created account. Then, you can reset its password in the Modify Account panel. 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 admin0  WITH LOGIN ENCRYPTED PASSWORD '111111' rds_superuser;
  • Create a standard account

Related operations

Operation Description
CreateAccount Creates a database account.
DescribeAccounts Queries the account information of an instance.
ModifyAccountDescription Modifies the account description of an instance.
ResetAccountPassword Resets the password of an account.