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 a 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.
  • The password must be 8 to 32 characters in length.
  • It can contain the following special characters: ! @ # $ % ^ & * ( ) _ + - =.
DBClusterId String Yes pc-**************

The ID of the cluster.

AccountType String No Normal

The account type. Valid values:

  • Normal: standard account
  • Super: privileged account
Note
  • If this parameter is not set, Super is the default value.
  • 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://.
  • The name must be 2 to 256 characters in length.
DBName String No testdb

The names of databases that can be accessed by the account. Separate multiple 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 set this parameter, the default value ReadWrite is used.
  • If you specify multiple names for the DBName parameter, you must grant corresponding permissions to the databases. Separate multiple account permissions with commas (,). For example, to grant the read and write permissions to Database 1 and grant the read-only permissions to Database 2, you must set DBName for Database 1 and Database 2, and set AccountPrivilege to ReadWrite,ReadOnly.
  • 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 request

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.