Creates a database account for a PolarDB cluster.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
polardb:CreateAccount | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
DBClusterId | string | Yes | The ID of cluster. | pc-************** |
AccountName | string | Yes | The name of the account. The name must meet the following requirements:
| testacc |
AccountPassword | string | Yes | The password of the account. The password must meet the following requirements:
| Test1111 |
AccountType | string | No | The type of the account. Valid values:
Note
| Normal |
AccountDescription | string | No | The description of the account. The description must meet the following requirements:
| testdes |
DBName | string | No | The name of the database that can be accessed by the account. To enter multiple database names, separate the names with commas (,). Note
This parameter is valid only for standard accounts of PolarDB for MySQL clusters.
| testdb |
AccountPrivilege | string | No | The permissions that are granted to the account. Valid values:
Note
| ReadWrite |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. The token is case-sensitive. | 6000170000591aed949d0f54a343f1a4233c1e7d1c5c****** |
PrivForAllDB | string | No | Specifies whether to grant the specified account required permissions on all existing databases in the current cluster and databases that will be further created for the current cluster. Valid values:
| 0 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "CED079B7-A408-41A1-BFF1-EC608E******"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | LockTimeout | The request processing has failed due to lock timeout. | Failed to process the request due to a lock timeout. |
400 | EngineMigration.ActionDisabled | Specified action is disabled while custins is in engine migration. | The specified operation is disabled when custins is being migrated across engines. |
400 | InvalidAccountPassword.Malformed | The specified parameter AccountPassword is not valid. | The specified AccountPassword parameter is invalid. |
400 | InvalidAccountType.Malformed | The specified parameter AccountType is not valid. | The specified AccountType parameter is invalid. |
400 | InvalidAccountDescription.Malformed | The specified parameter AccountDescription is not valid. | The specified AccountDescription parameter is invalid. |
400 | InvalidAccountPrivilege.Malformed | The specified parameter AccountPrivilege is not valid. | The specified AccountPrivilege parameter is invalid. |
400 | InvalidAccountName.Malformed | The specified parameter AccountName is not valid. | The specified AccountName parameter is invalid. |
404 | InvalidDBClusterId.NotFound | The DBClusterId provided does not exist in our records. | The specified DBClusterId parameter does not exist in the current record. |
404 | InvalidDBClusterId.Malformed | The specified parameter DBClusterId is not valid. | The specified DBClusterId parameter is invalid. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-01-24 | The Error code has changed | View Change Details |
2023-09-12 | The Error code has changed | View Change Details |
2023-07-20 | API Description Update. The Error code has changed. The request parameters of the API has changed | View Change Details |