All Products
Search
Document Center

AnalyticDB:Create a database account

Last Updated:Aug 23, 2023

This topic describes how to create a database account for an AnalyticDB for PostgreSQL instance.

Background information

AnalyticDB for PostgreSQL provides the following types of database accounts:

  • Privileged account: the account that has all permissions on all databases. The first account that is created for an instance in the console is a privileged instance.

  • Standard account: the account that has all permissions on 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.

Usage notes

  • Before you can use databases on an AnalyticDB for PostgreSQL instance, you must create a privileged account.

  • Standard accounts cannot be created in the console. For information about how to create standard accounts, see the "Execute SQL statements to create accounts" section of this topic.

  • After you create a privileged account for an instance, you cannot delete the privileged account.

Create a privileged account

  1. Log on to the AnalyticDB for PostgreSQL console.
  2. In the upper-left corner of the console, select a region.
  3. Find the instance that you want to manage and click the instance ID.
  4. In the left-side navigation pane, click Account Management.

  5. Click Create Account.

  6. In the Create Account panel, configure the parameters that are 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.

  7. Click OK.

Important

After the account is created, you can click Reset Password in the Actions column to modify 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 used before.

Execute SQL statements to create accounts

For information about the complete syntax of CREATE ROLE, see the "CREATE ROLE" section of the SQL syntax topic.

  • Create a privileged account.

    CREATE ROLE <Account name> WITH LOGIN ENCRYPTED PASSWORD <Password> RDS_SUPERUSER;

    Sample statement:

    CREATE role admin0  WITH LOGIN ENCRYPTED PASSWORD '111111' rds_superuser;
  • Create a standard account.

    CREATE ROLE <Account name> WITH LOGIN ENCRYPTED PASSWORD <Password>;

    Sample statement:

    CREATE role test1 WITH LOGIN ENCRYPTED PASSWORD '111111';

References

Manage account permissions

Related operations

Operation

Description

CreateAccount

Creates a privileged account.

DescribeAccounts

Queries the information about database accounts that are created for an instance.

ModifyAccountDescription

Modifies the description of a database account for an instance.

ResetAccountPassword

Resets the password of a database account for an instance.