Updated on 2026-11-06 GMT+08:00

Revoke Permissions

Function

Revokes permissions that have been granted to a user or role.

Syntax

REVOKE (privilege,...) ON (resource,..) FROM ((ROLE role_name) | (USER user_name),...);

Keywords

  • ROLE: Specifies that the following role_name is a role.
  • USER: Specifies that the following user_name is a user.

Precautions

  • privilege must be a permission that has been granted to the grantee on the resource. Otherwise, the revocation fails. For supported privilege types, see Data Permission List.
  • resource can be a database, table, view, column, or function. The formats are as follows:
    • Database format: databases.db_name.
    • Table format: databases.db_name.tables.table_name.
    • View format: databases.db_name.tables.view_name.
    • Column format: databases.db_name.tables.table_name.columns.column_name.
    • Function format: databases.db_name.functions.function_name.

Examples

  • Revoke the DROP database permission on database db1 from user user_name1.
    REVOKE DROP ON databases.db1 FROM USER user_name1; 
  • Revoke the SELECT permission on table tb1 in database db1 from user user_name1.
    REVOKE SELECT ON databases.db1.tables.tb1 FROM USER user_name1; 
  • Revoke the SELECT permission on table tb1 in database db1 from role role_name.
    REVOKE SELECT ON databases.db1.tables.tb1 FROM ROLE role_name;