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.


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 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:

  • The name must contain lowercase letters, digits, hyphens (-), and underscores (_).
  • The name must start with a lowercase letter and end with a letter or digit. The name must be 1 to 64 characters in length.
DBDescription String No testdesc

The description of the database. The description must meet the following requirements:

  • The description cannot start with http:// or https://.
  • The description must be 2 to 256 characters in length.
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.

  • You can specify only a standard account. By default, privileged accounts have full permissions.
  • This parameter is required if the cluster is a PolarDB-O or PolarDB for PostgreSQL cluster.
AccountPrivilege String No ReadWrite

The permissions of the account. Valid values:

  • ReadWrite: the read and write permissions.
  • ReadOnly: the 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 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.

  • The language must be compatible with the character set that is specified by CharacterSetName.
  • The specified value must be the same as that of the Collate parameter.

Response parameters

Parameter Type Example Description
RequestId String 93E98F25-BE02-40DA-83E3-F77F8D******

The ID of the request.


Sample requests

http(s):// Action=CreateDatabase
&<Common request parameters>

Sample success responses

XML format


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.