Create a database account

更新时间:
复制 MD 格式

AnalyticDB for MySQL supports two types of database accounts: privileged accounts and standard accounts. A privileged account can manage all standard accounts and databases. To perform database operations with a standard account, you must manually create the standard account and then grant it permissions.

Database account types

AnalyticDB for MySQL supports privileged accounts and standard accounts. The following table describes the differences between the two account types.

Account type

Description

privileged account

  • You can create and manage a privileged account only in the console.

  • You can create only one privileged account per cluster. A privileged account can manage all standard accounts and databases.

  • You can use a privileged account to terminate the connections of any standard account.

  • This account type provides extensive permissions for custom and fine-grained permission management, such as granting query permissions on different tables to different users.

  • In AnalyticDB for MySQL, a privileged account is equivalent to the root account in MySQL.

standard account

  • For Data Warehouse Edition clusters, you can create standard accounts only by using SQL statements.

  • For Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters, you can create standard accounts by using either SQL statements or the console.

  • You can create up to 256 standard accounts per cluster.

  • You must manually grant permissions on specified databases to a standard account. For more information, see GRANT and database permission model.

  • A standard account cannot terminate the database connections of other standard accounts.

Create a privileged account

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster that you want to manage and click the cluster ID.

  2. In the left-side navigation pane, click Accounts.

  3. Create a privileged account.

    • For Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters: Click Create Account. In the Create Account panel, configure the parameters.

    • For Data Warehouse Edition clusters: Click Create Privileged Account. In the Create Privileged Account panel, configure the parameters.

    Parameter

    Description

    Database Account

    The name of the privileged account. The name must meet the requirements shown in the console.

    Account Type

    • For a Data Warehouse Edition cluster, this parameter is fixed to Privileged Account and does not need to be configured.

    • For Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters, select Privileged Account.

    New Password

    The password for the privileged account. The password must meet the requirements shown in the console.

    Confirm Password

    Enter the password again to confirm.

    Description

    An optional description to help you manage the account.

  4. Click OK to create the account.

Create standard accounts and grant permissions

Console operations

You can create and grant permissions to a standard account in the console only for Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster that you want to manage and click the cluster ID.

  2. In the left-side navigation pane, click Accounts.

  3. Click Create Account.

  4. In the Create Account panel, set the following parameters.

    Parameter

    Description

    Database Account

    The name of the standard account. The name must meet the requirements shown in the console.

    Account Type

    Select Standard Account.

    Note

    If you want to use a RAM user to perform SQL development in the Enterprise Edition, Basic Edition, or Data Lakehouse Edition console, you must associate the RAM user with this standard account after you create the standard account.

    New Password

    The password for the standard account. The password must meet the requirements shown in the console.

    Confirm Password

    Enter the password again to confirm.

    Description

    An optional description to help you manage the account.

  5. Click OK.

  1. After the account is created, click Permissions in the Actions column for the account to configure its permissions.

Change an account password

If you forget a database account password, you can reset it in the console.

Important

For data security, we recommend that you change the password regularly.

On the Accounts page, click Change Password to the right of the account. Enter and confirm the new password as prompted, and then click OK.

SQL operations

You can use SQL statements to create and grant permissions to standard accounts for both Data Warehouse Edition and Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters. Standard accounts created using SQL statements appear in the console for Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters, but not for Data Warehouse Edition clusters. For Data Warehouse Edition clusters, you must run the SELECT User FROM mysql.user; statement to view the accounts.

You can use the following SQL operations to manage database accounts: