Creating a Database Account

Scenarios

When you create a MySQL DB instance, user root is created synchronously by default. You can create accounts as required.

You can create an account in either of the following ways:
  • Through RDS: which is easy to use and frees you from remembering commands.
  • Through DAS: which is powerful and flexible but you need to be familiar with the creation commands.

Constraints

Database accounts cannot be created for DB instances that are being restored.

Creating an Account Through RDS

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click Service List. Under Database, click Relational Database Service. The RDS console is displayed.
  4. On the Instance Management page, click the target DB instance.
  5. On the Accounts page, click Create Account. In the displayed dialog box, enter a username, authorize permissions for databases, enter a password, and confirm the password. Then, click OK.

    Figure 1 Creating an account
    • The username consists of 1 to 32 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.
      • If the database version is MySQL 5.6, the username consists of 1 to 16 characters.
      • If the database version is MySQL 5.7 or 8.0, the username consists of 1 to 32 characters.
    • Select unauthorized databases and click to authorize them or select authorized databases and click to revoke permissions.

      If there are no unauthorized databases, you can create one by referring to section Creating a Database. You can also modify the permissions after the database creation by referring to section Changing Permissions.

    • The password must consist of 8 to 32 characters and contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters (~!@#%^*-_=+?,).
    • If you require fined-grained authorization, log in to the database through the DAS console.

  6. After the account is created, you can manage it on the Accounts page of the selected DB instance.

Creating an Account Through DAS

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click Service List. Under Database, click Relational Database Service. The RDS console is displayed.
  4. On the Instance Management page, locate the target DB instance and click Log In in the Operation column.

    Figure 2 Logging in to a database through DAS

  5. On the displayed page, enter the correct username and password and click Log In.
  6. Create an account.

    • On the top menu bar, choose More > User Management. The page for managing users is displayed. On the displayed page, click Create User. Then, configure required information, such as basic information, advanced settings, global permissions, and object permissions, and click Save. In the displayed dialog box, click OK.
    • You can also run the following command on the SQL Window tab to create an account:
      create user account name;