Creates a database in an ApsaraDB for RDS instance.

Before you call this operation, make sure that the following requirements are met:

  • The RDS instance is in the Running state.
  • The number of databases in the RDS instance does not exceed the upper limit. You can call the DescribeDBInstanceAttribute operation to query the maximum number of databases allowed.
  • The RDS instance is not a read-only instance.
    Note This operation is not supported for SQL Server 2017 in the Cluster Edition, PostgreSQL, or PPAS. In these database engines, you can execute CREATE DATABASE statements to create databases.

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 CreateDatabase

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

DBName String Yes rds_mysql

The name of the database you want to create.

Note
  • The name must be 2 to 64 characters in length.
  • The name must start with a lowercase letter and end with a lowercase letter or digit.
  • The name can contain lowercase letters, digits, underscores (_), and hyphens (-).
  • The name must be unique in the instance.
  • For more information about invalid characters, see Forbidden keywords table.
CharacterSetName String Yes gbk

The character set you want to use for the database. Valid values:

  • MySQL and MariaDB: utf8 | gbk | latin1 | utf8mb4.
  • SQL Server: Chinese_PRC_CI_AS | Chinese_PRC_CS_AS | SQL_Latin1_General_CP1_CI_AS | SQL_Latin1_General_CP1_CS_AS | Chinese_PRC_BIN.
  • PostgreSQL: KOI8U | UTF8 | WIN866 | WIN874 | WIN1250 | WIN1251 | WIN1252 | WIN1253 | WIN1254 | WIN1255 | WIN1256 | WIN1257 | WIN1258 | EUC_CN | EUC_KR | EUC_TW | EUC_JP | EUC_JIS_2004 | KOI8R | MULE_INTERNAL | LATIN1 | LATIN2 | LATIN3 | LATIN4 | LATIN5 | LATIN6 | LATIN7 | LATIN8 | LATIN9 | LATIN10 | ISO_8859_5 | ISO_8859_6 | ISO_8859_7 | ISO_8859_8 | SQL_ASCII.
DBDescription String No testdatabase

The description of the database. The description must be 2 to 256 characters in length. The description must start with a letter and can contain letters, digits, underscores (_), and hyphens (-).

Note The description cannot start with http:// or https://.
AccessKeyId String No LTAIfCxxxxxxx

The AccessKey ID provided to you by Alibaba Cloud.

Response parameters

Parameter Type Example Description
RequestId String 5A77D650-27A1-4E08-AD9E-59008EDB6927

The ID of the request.

Examples

Sample requests


http(s)://rds.aliyuncs.com/? Action=CreateDatabase
&DBInstanceId=rm-uf6wjk5xxxxxxxxxx
&DBName=rds_mysql
&CharacterSetName=gbk
&<Common request parameters>

Sample success responses

XML format

<CreateDatabaseResponse>
           <RequestId>5A77D650-27A1-4E08-AD9E-59008EDB6927</RequestId>
</CreateDatabaseResponse>

JSON format

{
	"RequestID":"5A77D650-27A1-4E08-AD9E-59008EDB6927"
}

Error codes

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