Creates a database on an instance.
Operation Description
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 of DMS.
Before you call this operation, make sure that the following requirements are met:
- The original instance is in the Running state.
- The maximum number of databases that can be created on an instance is not reached. You can call the DescribeDBInstanceAttribute operation to query the maximum number of databases that can be created on an instance.
- The instance is not a read-only instance.
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
rds:CreateDatabase | WRITE |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
DBInstanceId | string | Yes | The ID of the instance. | rm-uf6wjk5xxxxxxxxxx |
DBName | string | Yes | The name of the database. Note
| rds_mysql |
CharacterSetName | string | Yes | The character set.
| gbk |
DBDescription | string | No | The description of the database. The description must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The description must start with a letter. NoteThe value cannot start with http:// or https:// . | Database for testing |
ResourceGroupId | string | No | The ID of a resource group. | rg-acfmy***** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "5A77D650-27A1-4E08-AD9E-59008EDB6927"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | EngineMigration.ActionDisabled | Specified action is disabled while custins is in engine migration. | The specified operation is disabled when the instance is being migrated across engines. |
400 | Database.ConnectError | Database connect error. please check instance status and database processlist | A database connection error occurred. Check the instance state and the database connection pool. |
400 | InvalidDescription.Format | Specified description is not valid. | The description is invalid. |
400 | InvalidDBName.Forbid | Specified DB name is a keyword in RDS. | Failed to specify the database name. The database name cannot contain the forbidden keyword DBName. Modify the database name. |
400 | InvalidAccountName.Forbid | Specified account name is a keyword in RDS. | The username is invalid. Forbidden keywords cannot be used for a username. Modify the username. |
400 | InvalidAccountPrivilege.Malformed | Specified account privilege is not valid. | Your account does not have the required permissions. |
400 | IncorrectDBInstanceServiceType | Current DB instance top type does not support this operation. | - |
400 | Database.AddError | Create Db failed, please check input value and instance status. | Failed to create the database. Check the specified parameters and the instance status. |
400 | Database.QueryError | invalid value, may include special character. | The value is invalid and may contain special characters. |
404 | InvalidDBInstanceName.NotFound | The database instance does not exist. | The name of the RDS instance cannot be found. Check the name of the RDS instance. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2023-04-03 | The error codes of the API operation change. | |||||||
| ||||||||
2023-03-24 | The error codes of the API operation change. | |||||||
| ||||||||
2022-10-28 | The error codes of the API operation change. | |||||||
| ||||||||
2022-06-23 | API Description Update,The error codes of the API operation change. | |||||||
|