Creates a database account for a specified PolarDB cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No CreateAccount

The operation that you want to perform. Set the value to CreateAccount.

AccountName String Yes testacc

The name of the account. The account name must meet the following requirements:

  • It must start with a lowercase letter and end with a digit or letter.
  • It can contain lowercase letters, digits, and underscores (_).
  • It must be 2 to 16 characters in length.
  • It cannot be a system reserved username, such as root or admin.
AccountPassword String Yes Test1111

The password of the account. The password must meet the following requirements:

  • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • It must be 8 to 32 characters in length.
  • It can contain the following special characters: !@#$%^&*()_+-=.
DBClusterId String Yes pc-**************

The ID of the PolarDB cluster.

AccountType String No Normal

The account type. Valid values:

  • Normal: standard account
  • Super: privileged account
Note
  • If you do not specify this parameter, a privileged account is created by default (Super).
  • You can create only one privileged account for each cluster. A privileged account has more permissions than a standard account. For more information about how to create a database account, see Create a database account.
AccountDescription String No testdes

The description of the account. The description must meet the following requirements:

  • It cannot start with http:// or https://.
  • It must be 2 to 256 characters in length.
DBName String No testdb

The names of the databases that the account can access. If you need to specify multiple database names, separate the database names with commas (,).

Note This parameter is applicable to only standard accounts of PolarDB for MySQL clusters.
AccountPrivilege String No ReadWrite

The account permission. Valid values:

  • ReadWrite: The account has the read and write permissions on the databases.
  • ReadOnly: The account has the read permissions on the databases.
  • DMLOnly: The account has the permissions to execute only data manipulation language (DML) statements on the databases.
  • DDLOnly: The account has the permissions to execute only data definition language (DDL) statements on the databases.
  • ReadIndex: The account has the read and index permissions on the databases.
Note
  • If you do not specify this parameter, the default value ReadWrite is used.
  • This parameter is applicable to only standard accounts of PolarDB for MySQL clusters.

Response parameters

Parameter Type Example Description
RequestId String CED079B7-A408-41A1-BFF1-EC608E******

The ID of the request.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/? Action=CreateAccount
&AccountName=testacc
&AccountPassword=Test1111
&DBClusterId=pc-**************
&<Common request parameters>

Sample success responses

XML format

<CreateAccountResponse>
  <RequestId>CED079B7-A408-41A1-BFF1-EC608E******</RequestId>
</CreateAccountResponse>

JSON format

{
    "RequestId": "CED079B7-A408-41A1-BFF1-EC608E******"
}

Error codes

For a list of error codes, visit the API Error Center.