Creates a PolarDB-X database.

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 Yes CreateDB

The operation that you want to perform. Set the value to CreateDB.

RegionId String Yes cn-hangzhou

The ID of the region where your PolarDB-X instance is deployed.

DBInstanceName String Yes pxc-**************

The name of the PolarDB-X instance.

AccountName String Yes testaccount

The username of the account that is used to access the database.

Charset String Yes utf8mb4

The character set that the database supports. For example, you can set the value to utf8mb4.

DbName String Yes testdb

The name of the database.

AccountPrivilege String Yes ReadWrite

The permissions on the database. Specify the type of permission that you want to grant to the account that is specified by the AccountName parameter. Valid values:

  • ReadWrite
  • ReadOnly
  • DMLOnly
  • DDLOnly
DbDescription String No db for test

The description of the database.

SecurityAccountName String No securityAccount

The username of the data security administrator (DSA) account.

Note If the three-role mode is enabled for the PolarDB-X instance, you must specify this parameter.
SecurityAccountPassword String No securityPassword

The password of the DSA account.

Note If the three-role mode is enabled for the PolarDB-X instance, you must specify this parameter.
Mode String No auto

The method that you want to use to partition tables in the database. Valid values:

  • auto: The system automatically partitions tables in the database. You do not need to specify a partition key when you create a table.
  • drds: The system does not automatically partition tables in the database. You must specify a sharding key when you create a table.

Response parameters

Parameter Type Example Description
Message String *****

The error message that is returned. If the request is successful, the value of this parameter is empty.

RequestId String 9B2F3840-5C98-475C-B269-2D5C3A31797C

The ID of the request.

Success Boolean true

Indicates whether the operation is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateDB
&RegionId=cn-hangzhou
&DBInstanceName=pxc-**************
&AccountName=testaccount
&Charset=utf8mb4
&DbName=testdb
&AccountPrivilege=ReadWrite
&DbDescription=db for test
&SecurityAccountName=securityAccount
&SecurityAccountPassword=securityPassword
&Mode=auto
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateDBResponse>
    <Message>*****</Message>
    <RequestId>9B2F3840-5C98-475C-B269-2D5C3A31797C</RequestId>
    <Success>true</Success>
</CreateDBResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "*****",
  "RequestId" : "9B2F3840-5C98-475C-B269-2D5C3A31797C",
  "Success" : true
}

Error codes

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