tencent cloud

Feedback

ModifyAccountPrivileges

Last updated: 2024-07-19 14:30:57

    1. API Description

    Domain name for API request: dcdb.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: 2018-04-11.
    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: "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. Value range: "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 not passed in, no change will be made to the granted stored procedure 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 view permissions. To clear the granted table permissions, set Privileges to an empty array.
    ColumnPrivileges.N No Array of ColumnPrivilege Column permission in the table. Valid values: "SELECT", "INSERT", "UPDATE", "REFERENCES".
    Note: If the parameter is not passed in, 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 table permissions. To clear the granted view 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, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). 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

    POST / HTTP/1.1Host: dcdb.tencentcloudapi.comContent-Type: application/jsonX-TC-Action: ModifyAccountConfig<common request parameters>{    "InstanceId": "
    

    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.