Grants an account the permissions on a database of an ApsaraDB for RDS instance.

Each account can be granted permissions on one or more databases. Before you call this operation, make sure that the instance is in the Running state.

Note If the instance is running SQL Server 2017 and the Cluster Edition, PostgreSQL based on local SSDs, or PPAS, this operation is not supported.

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 GrantAccountPrivilege

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

AccountName String Yes test1

The name of the account.

AccountPrivilege String Yes ReadWrite

The permissions that you want to grant to the account. Valid values:

  • ReadWrite
  • ReadOnly
  • DDLOnly
  • DMLOnly
  • DBOwner
Note
  • If the instance is running MySQL or MariaDB, you can set this parameter to ReadWrite, ReadOnly, DDLOnly, or DMLOnly.
  • If the instance is running SQL Server, you can set this parameter to ReadWrite, ReadOnly, or DBOwner.
  • If the instance is running PostgreSQL based on standard or enhanced SSDs, you can set this parameter only to DBOwner.
DBInstanceId String Yes rm-uf6wjk5xxxxxxxxxx

The ID of the instance.

DBName String Yes testDB

The name of the database on which you want to grant permissions.

Response parameters

Parameter Type Example Description
RequestId String 81BC9559-7B22-4B7F-B705-5F56DEECDEA7

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=GrantAccountPrivilege
&DBInstanceId=rm-uf6wjk5xxxxxxx
&AccountName=test1
&DBName=test
&AccountPrivilege=ReadWrite
&<Common request parameters>

Sample success responses

XML format

<GrantAccountPrivilegeResponse>
      <RequestId>81BC9559-7B22-4B7F-B705-5F56DEECDEA7</RequestId>
</GrantAccountPrivilegeResponse>

JSON format

{
       "RequestId":"81BC9559-7B22-4B7F-B705-5F56DEECDEA7"
}

Error codes

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