You need to enable JavaScript to run this app.
RDS for MySQL

RDS for MySQL

Copy page
Download PDF
Managing databases
CreateDatabase
Copy page
Download PDF
CreateDatabase
Call the CreateDatabase API to create a database.​
Request type​
Synchronous request.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
​
Parameter​
Type​
Is it required?​
Sample value​
Description​
InstanceId​
String​
Yes​
mysql-r3xq0zdl****​
Instance ID.​
DBName​
String​
Yes​
testdb1​
Database name. Naming rules are as follows:​
  • The name must be unique.​
  • 2 to 64 characters in length.​
  • The name must start with a letter and end with a letter or a digit.​
  • It consists of letters, digits, underscores (_), or hyphens (-).​
  • It cannot contain certain reserved words, including root and admin. Refer to the List of forbidden keywords for forbidden reserved words.​
CharacterSetName​
String​
No​
utf8​
Database character set. Supported character sets include: utf8, utf8mb4 (default), latin1, and ascii.​
DatabasePrivileges​
No​
[​
{​
"AccountName": "user1",​
"Host":"%",​
"AccountPrivilege":"ReadWrite"​
}​
]​
Database authorization information.​
DBDesc​
String​
No​
This is a database description.​
The description of the database cannot exceed 256 characters. This field is optional. If this field is not set, or if the description length is 0, the description is empty.​
​
DatabasePrivilegeObject​
​
Parameter​
Type​
Is it required?​
Sample value​
Description​
AccountName​
String​
Yes​
testdb1​
The name of the account to be authorized first.​
Host​
String​
No​
%​
The Internet protocol address from which the specified database account can access the database. The default value is %.​
  • If the host is specified as %, allow the account to access the database from any IP address.​
  • If the host is set to 192.10.10.%, the account can access the database from any IP address in the range of 192.10.10.0 to 192.10.10.255.​
  • The specified host needs to be added to the allowlist associated with the instance.​
AccountPrivilege​
String​
Yes​
ReadWrite​
Type of privilege granted to the account. Valid values:​
  • ReadWrite: Read/Write privilege.​
  • ReadOnly: read-only privilege.​
  • DDLOnly: only DDL privilege.​
  • DMLOnly: only DML privilege.​
  • Custom: custom privilege.​
tip​
Select only one privilege type. An error occurs if multiple privileges are passed.​
AccountPrivilegeDetail​
String​
No​
SELECT,INSERT,UPDATE​
Database privilege string.​
This parameter is required when AccountPrivilege is Custom. Valid values:​
  • SELECT​
  • INSERT​
  • UPDATE​
  • DELETE​
  • CREATE​
  • DROP​
  • REFERENCES​
  • INDEX​
  • ALTER​
  • CREATE TEMPORARY TABLES​
  • LOCK TABLES​
  • EXECUTE​
  • CREATE VIEW​
  • SHOW VIEW​
  • CREATE ROUTINE​
  • ALTER ROUTINE​
  • EVENT​
  • TRIGGER​
  • When returned as a result, the detailed privileges for AccountPrivilege are displayed regardless of whether its value is Custom.​
tip​
Multiple strings are separated by a comma (,).​
​
Response parameter​
null​
Sample​
Sample request​
​
POST /?Action=CreateDatabase&Version=2022-01-01 HTTP/1.1​
Content-Type: application/json​
Host: rds-mysql.cn-beijing.volcengineapi.com​
X-Date: 20211202T101010Z​
Authorization: HMAC-SHA256 Credential=AKLTN2I0MmFiNzMxNWE5NDgzMzk4MmVjMTVkODlkZTZ****/20211202/cn-beijing/rds_mysql/request,SignedHeaders=x-date, Signature=71d31fc7bcf990142851c9833c5656391486cda0ae2e0b8ada733b7c6458****​
{​
"InstanceId": "mysql-4674157d****",​
"DBName": "test",​
"DBDesc": "这是一段数据库 testdb 的描述信息。"​
}​
​
Sample response​
​
{​
"ResponseMetadata": {​
"RequestId": "202301102106150EF6F410713D7FE58AAE",​
"Action": "CreateDatabase",​
"Version": "2022-01-01",​
"Service": "rds_mysql",​
"Region": "cn-beijing"​
},​
"Result": null​
}​
​
Error code​
For more details, refer to Error codes.​
Last updated: 2026.06.12 17:17:52