You can call the CreateDatabase operation to create a database on an ApsaraDB RDS instance.
If you want to perform data management tasks, such as data change and schema design, use Data Management (DMS). For more information, see List of operations by function.
Before you call this operation, make sure that the following requirements are met:
- The instance must be in the Running state.
- The number of databases on the instance cannot exceed the upper limit. You can call the DescribeDBInstanceAttribute operation to query the upper limit.
-
The instance cannot be a read-only instance.Note This operation is not supported for instances that run PostgreSQL (with local SSDs), or SQL Server 2017 EE. To create a database on such an instance, you can execute the CREATE DATABASE statement.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateDatabase |
The operation that you want to perform. Set the value to CreateDatabase. |
CharacterSetName | String | Yes | gbk |
The character set that you want to use for the database. Valid values:
|
DBInstanceId | String | Yes | rm-uf6wjk5xxxxxxxxxx |
The ID of the instance. |
DBName | String | Yes | rds_mysql |
The name of the database. Note
|
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://.
|
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.