REVOKE

Description

Removes one or more privileges on a securable object from a role. The privileges that can be revoked are object-specific.

Syntax

1. > REVOKE [IF EXISTS]
2. priv_type [(column_list)]
3. [, priv_type [(column_list)]] ...
4. ON object_type priv_level

6. > REVOKE [IF EXISTS] role [, role ] ...
7. FROM user_or_role [, user_or_role ] ...

Examples

1. > CREATE USER mouser IDENTIFIED BY '111';
2. Query OK, 0 rows affected (0.10 sec)

4. > CREATE ROLE role_r1;
5. Query OK, 0 rows affected (0.05 sec)

7. > GRANT role_r1 to mouser;
8. Query OK, 0 rows affected (0.04 sec)

10. > GRANT create table on database * to role_r1;
11. Query OK, 0 rows affected (0.03 sec)

13. > SHOW GRANTS for mouser@localhost;
14. +-------------------------------------------------------+
15. | Grants for mouser@localhost                           |
16. +-------------------------------------------------------+
17. | GRANT create table ON database * `mouser`@`localhost` |
18. | GRANT connect ON account  `mouser`@`localhost`        |
19. +-------------------------------------------------------+
20. 2 rows in set (0.02 sec)

22. > REVOKE role_r1 from mouser;
23. Query OK, 0 rows affected (0.04 sec)

25. > SHOW GRANT for mouser@localhost;
26. +------------------------------------------------+
27. | Grants for mouser@localhost                    |
28. +------------------------------------------------+
29. | GRANT connect ON account  `mouser`@`localhost` |
30. +------------------------------------------------+
31. 1 row in set (0.02 sec)