Call the GrantDatabasePrivilege API to add authorized database accounts for the specified database.
Synchronous request.
Name | Type | Required | Example | Description |
|---|---|---|---|---|
InstanceId | String | Yes | mysql-r3xq0zdl**** | Instance ID. |
DBName | String | Yes | testuser1 | Database name. |
DatabasePrivileges | Object[] | Yes | [
{
"AccountName":"testuser",
"Host": "192.***.***.2",
"AccountPrivilege":"ReadWrite"
}
] | List of database account permissions. |
AccountName | String | Yes | testdb1 | The name of the account that requires authorization. |
Host | String | No | % | The specified database account can access the IP address of the database. The default value is %.
|
AccountPrivilege | String | Yes | ReadWrite | The type of account permission granted, with the following values:
tip The permission type is single-choice. An error will be reported if multiple permissions are passed. |
AccountPrivilegeDetail | String | No | SELECT,INSERT,UPDATE | Database privilege string. When used as a request parameter, it is required when the value of AccountPrivilege is
When used as a return result, regardless of whether the value of AccountPrivilege is tip Multiple strings are separated by English commas (,). |
null
POST /?Action=GrantDatabasePrivilege&Version=2022-01-01 HTTP/1.1 Accept: application/json 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-7582b02b****", "DBName": "testdb1", "DatabasePrivileges": [ { "AccountName": "testuser1", "Host": "192.***.***.2", "AccountPrivilege": "ReadWrite" } ] }
{ "ResponseMetadata": { "RequestId": "202301161533354BFF2A1927E50A101666", "Action": "GrantDatabasePrivilege", "Version": "2022-01-01", "Service": "rds_mysql", "Region": "cn-beijing" }, "Result": null }
For more details, refer to Error codes.