Creates a database for a specified PolarDB cluster.
Before you call this operation, make sure that the following requirements are met:
- The cluster is in the Running state.
- The cluster is not locked.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | No | CreateDatabase |
The operation that you want to perform. Set the value to CreateDatabase. |
CharacterSetName | String | Yes | utf8 |
The character set. For more information, see Character sets. |
DBClusterId | String | Yes | pc-************** |
The ID of the cluster. |
DBName | String | Yes | testDB |
The name of the database. The name must meet the following requirements:
|
DBDescription | String | No | testdesc |
The description of the database. The description must meet the following requirements:
|
AccountName | String | No | testacc |
The name of the authorized account that you use to connect to the database. You can call the DescribeAccounts operation to query the information about the account. Note
|
AccountPrivilege | String | No | ReadWrite |
The permissions of the account. Valid values:
If you do not specify this parameter, the default value ReadWrite is used. Note This parameter is valid only when the AccountName parameter is specified.
|
Collate | String | No | C |
The language that specifies the collation of the database that is to be created. Note The language must be compatible with the character set that is specified by CharacterSetName.
|
Ctype | String | No | C |
The language that specifies the character classification for the database. Note
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 93E98F25-BE02-40DA-83E3-F77F8D****** |
The ID of the request. |
Examples
Sample requests
http(s)://polardb.aliyuncs.com/? Action=CreateDatabase
&CharacterSetName=utf8
&DBClusterId=pc-**************
&DBName=testDB
&<Common request parameters>
Sample success responses
XML
format
<CreateDatabaseResponse>
<RequestId>93E98F25-BE02-40DA-83E3-F77F8D******</RequestId>
</CreateDatabaseResponse>
JSON
format
{
"RequestId": "93E98F25-BE02-40DA-83E3-F77F8D******"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | InvalidDBName.Malformed | The specified parameter DBName is not valid. | The specified value of the DBName parameter is invalid. |
For a list of error codes, visit the API Error Center.