Creates a database for a 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 unlocked.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | No | CreateDatabase |
The operation that you want to perform. Set the value to CreateDatabase. |
DBClusterId | String | Yes | pc-************** |
The ID of the PolarDB cluster. |
DBName | String | Yes | testDB |
The name of the database. The name must meet the following requirements:
Note The name cannot be
test , mysql , or another keyword that is reserved by the system.
|
CharacterSetName | String | Yes | utf8 |
The character set that is used by the database. For more information, see Character sets. |
DBDescription | String | No | testdesc |
The description of the database. The description must meet the following requirements:
Note If the database engine of the PolarDB cluster is PolarDB for Oracle or the PolarDB
for PostgreSQL, this parameter is required. If the database engine of the PolarDB
cluster is the PolarDB for MySQL, this parameter is optional.
|
AccountName | String | No | testacc |
The name of the account that is authorized to access the database. You can call the DescribeAccounts operation to query account information. Note
|
AccountPrivilege | String | No | ReadWrite |
The permissions of the account. Valid values:
If you leave this parameter empty, the default value ReadWrite is used. Note
|
Collate | String | No | C |
The language that specifies the collation of the database that is to be created. Note
|
Ctype | String | No | C |
The language that specifies the character type of 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
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateDatabaseResponse>
<RequestId>93E98F25-BE02-40DA-83E3-F77F8D******</RequestId>
</CreateDatabaseResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "93E98F25-BE02-40DA-83E3-F77F8D******"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidDBName.Malformed | The specified parameter DBName is not valid. | The error message returned because the specified value of the DBName parameter is invalid. |
For a list of error codes, visit the API Error Center.