This topic describes how to revoke privileges from a user.
Prerequisites
You must have the privileges to be revoked and the
GRANT OPTIONprivilege. For example, if thetest1user wants to revoke theSELECTprivilege on thet1table from thetest2user, thetest1user must have theSELECTprivilege on thet1table.To revoke the
ALL PRIVILEGESandGRANT OPTIONprivileges, you must have the globalGRANT OPTIONprivilege or theUPDATEandDELETEprivileges on the table.
Considerations
When you revoke multiple privileges from a user at a time, separate the privileges with commas (,).
When you revoke a privilege from multiple users at a time, separate the usernames with commas (,).
The revocation does not cascade to dependent users. For example, if the
test1user has granted some privileges to thetest2user, when the privileges of thetest1user are revoked, the privileges granted to thetest2user will not be revoked.
Examples
Revoke global privileges
To revoke the
INSERTandSELECTprivileges on all tables in all databases from thetestuser, execute the following statement:obclient> REVOKE SELECT, INSERT ON *.* FROM 'test';Revoke database-level privileges
To revoke the
INSERTandSELECTprivileges on all tables in thedb1database from thetestuser, execute the following statement:obclient> REVOKE SELECT, INSERT ON db1 FROM 'test';Revoke table-level privileges
To revoke the
INSERTandSELECTprivileges on thetb1_nametable in thedb1database from thetestuser, execute the following statement:obclient> REVOKE SELECT, INSERT ON db1.tb1_name FROM 'test';Revoke column-level privileges
To revoke the
SELECTprivilege on thec1column and theINSERTprivilege on thec1andc2columns of thetb1_nametable in thedb1database from thetestuser, execute the following statement:obclient> REVOKE SELECT(c1), INSERT (c1, c2) ON db1.tb1_name FROM test;
For more information about the REVOKE statement, see REVOKE.