You can call this operation to create a database account for a specified ApsaraDB for 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
AccountName String Yes testacc The name of the database account.
  • It must start with a lowercase letter and contains lowercase letters, digits, and underscores (_).
  • It can be up to 16 characters in length.
AccountPassword String Yes Pw123456 The password of the database account.
  • It must contain uppercase letters, lowercase letters, digits, and special characters. Special characters include ! # $ % ^ & * ( ) _ + - =.
  • It must be 8 to 32 characters in length.
DBClusterId String Yes pc-xxxxxxxxxxxxxxx The ID of the cluster.
AccessKeyId String No key-test The AccessKey ID provided to you by Alibaba Cloud.
AccountDescription String No test

The description of the account.

  • It cannot start with http:// or https://.
  • It must be 2 to 256 characters in length.
AccountPrivilege String No ReadWrite The permissions of the database account on the database. Valid values:
  • ReadWrite: read and write permissions.
  • ReadOnly: read-only permissions.
  • DMLOnly: executes only data manipulation language (DML) statements.
  • DDLOnly: executes only data definition language (DDL) statements.

If you do not specify this parameter, the default value is ReadWrite.

Note This parameter is only applicable to standard accounts of PolarDB MySQL clusters.
AccountType String No Super

The type of the account. Valid values:

  • Normal: standard account
  • Super: privileged account

Default value: Super. For more information about how to create a database account, click Create database accounts.

Note
  • You can create only one privileged account for each PolarDB MySQL cluster.
  • Privileged accounts have more permissions than standard accounts.
Action String No CreateAccount The operation that you want to perform. Set the value to CreateAccount.
DBName String No DB-test The names of the databases to which the account is granted access. Separate multiple databases with commas (,).
Note This parameter is only applicable to standard accounts of PolarDB MySQL clusters.

Response parameters

Parameter Type Example Description
RequestId String 2FED790E-FB61-4721-8C1C-07C627FA5A19 The ID of the request.

Examples

Sample requests


http(s)://[Endpoint]/? Action=CreateAccount
&AccountName=testacc
&AccountPassword=Pw123456
&DBClusterId=pc-xxxxxxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<CreateAccountResponse>  
       <RequestId>2FED790E-FB61-4721-8C1C-07C627FA5A19</RequestId>
</CreateAccountResponse>

JSON format

{
    "RequestId":"2FED790E-FB61-4721-8C1C-07C627FA5A19"
}

Error codes

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