tencent cloud

Feedback

ModifyAccountPrivileges

Last updated: 2023-06-21 15:55:41

1. API Description

Domain name for API request: mariadb.tencentcloudapi.com.

This API is used to modify the permissions of a TencentDB instance account. \n\nNote\n-Only the SELECT permission (that is, set the permission parameter to ["SELECT"]) of the system database mysql can be granted.An error will be reported if read-write permissions are granted to a read-only account. If the parameter is not passed in, no change will be made to the granted table permissions. To clear the granted view permissions, set Privileges to an empty array.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyAccountPrivileges.
Version Yes String Common Params. The value used for this API: 2017-03-12.
Region No String Common Params. This parameter is not required for this API.
InstanceId Yes String Instance ID in the format of tdsql-c1nl9rpv. It is the same as the instance ID displayed in the TencentDB console.
Accounts.N Yes Array of Account Database account, including username and host address.
GlobalPrivileges.N No Array of String Global permission. Valid values of GlobalPrivileges: "SELECT", "INSERT", "UPDATE", "DELETE", "CREATE", "PROCESS", "DROP", "REFERENCES", "INDEX", "ALTER", "SHOW DATABASES", "CREATE TEMPORARY TABLES", "LOCK TABLES", "EXECUTE", "CREATE VIEW", "SHOW VIEW", "CREATE ROUTINE", "ALTER ROUTINE", "EVENT", "TRIGGER".
Note: if the parameter is left empty, no change will be made to the granted global permissions. To clear the granted global permissions, set the parameter to an empty array.
DatabasePrivileges.N No Array of DatabasePrivilege Database permission. Valid values of Privileges: "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".
Note: if the parameter is left empty, no change will be made to the granted database permissions. To clear the granted database permissions, set Privileges to an empty array.
TablePrivileges.N No Array of TablePrivilege Database table permission. Valid values of Privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER.
Note: if the parameter is not passed in, no change will be made to the granted table permissions. To clear the granted table permissions, set Privileges to an empty array.
ColumnPrivileges.N No Array of ColumnPrivilege Column permission. Valid values of Privileges: "SELECT", "INSERT", "UPDATE", "REFERENCES".
Note: if the parameter is left empty, no change will be made to the granted column permissions. To clear the granted column permissions, set Privileges to an empty array.
ViewPrivileges.N No Array of ViewPrivileges Database view permission. Valid values of Privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER.
Note: if the parameter is not passed in, no change will be made to the granted view permissions. To clear the granted view permissions, set Privileges to an empty array.
FunctionPrivileges.N No Array of FunctionPrivilege Database function permissions. Valid values of Privileges: ALTER ROUTINE, EXECUTE.
Note: if the parameter is not passed in, no change will be made to the granted function permissions. To clear the granted function permissions, set Privileges to an empty array.
ProcedurePrivileges.N No Array of ProcedurePrivilege Database stored procedure permission. Valid values of Privileges: ALTER ROUTINE, EXECUTE.
Note: if the parameter is not passed in, no change will be made to the granted stored procedure permissions. To clear the granted stored procedure permissions, set Privileges to an empty array.

3. Output Parameters

Parameter Name Type Description
FlowId Integer Async task ID, which can be used in the DescribeFlow API to query the async task result.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Modifying the permissions of a TencentDB instance account

This example shows you how to modify the permissions of a TencentDB instance account.

Input Example

https://mariadb.tencentcloudapi.com/?Action=ModifyAccountPrivileges&InstanceId=tdsql-f35wr6wj&Accounts.0.User=ajnnw&GlobalPrivileges.0=SELECT&Accounts.0.Host=127.0.0.1&<common request parameters>

Output Example

{
    "Response": {
        "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
        "FlowId": 145623
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure CAM signature/authentication error
FailedOperation.CreateFlowFailed Failed to create the flow.
FailedOperation.OssOperationFailed Failed to request the backend API.
InternalError.DbOperationFailed Failed to query the database.
InvalidParameterValue.BadUserRight The specified permission could not be granted to this account.
ResourceUnavailable.InstanceHasBeenLocked The database instance has been locked. Operations are not allowed.
ResourceUnavailable.InstanceStatusAbnormal Incorrect database instance status. Operations are not allowed.
UnauthorizedOperation.PermissionDenied You have no permission to manipulate this API or resource.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support