REVOKE <roles>

The REVOKE <roles> statement lets you revoke a role or user's membership to a role.

Note:
REVOKE <roles> is an enterprise-only feature.

Synopsis

REVOKEADMINOPTIONFORrole_name,FROMuser_name,

Required privileges

The user revoking role membership must be a role admin (i.e., members with the ADMIN OPTION) or a superuser (i.e., a member of the admin role).

Considerations

  • The root user cannot be revoked from the admin role.

Parameters

ParameterDescription
ADMIN OPTIONRevoke the user's role admin status.
role_nameThe name of the role from which you want to remove members. To revoke members from multiple roles, use a comma-separated list of role names.
user_nameThe name of the user or role from whom you want to revoke membership. To revoke multiple members, use a comma-separated list of user and/or role names.

Examples

Revoke role membership

  1. > SHOW GRANTS ON ROLE design;
  1. +--------+---------+---------+
  2. | role | member | isAdmin |
  3. +--------+---------+---------+
  4. | design | barkley | false |
  5. | design | ernie | true |
  6. | design | lola | false |
  7. | design | lucky | false |
  8. +--------+---------+---------+
  1. > REVOKE design FROM lola;
  1. > SHOW GRANTS ON ROLE design;
  1. +--------+---------+---------+
  2. | role | member | isAdmin |
  3. +--------+---------+---------+
  4. | design | barkley | false |
  5. | design | ernie | true |
  6. | design | lucky | false |
  7. +--------+---------+---------+

Revoke the admin option

To revoke a user or role's admin option from a role (without revoking the membership):

  1. > REVOKE ADMIN OPTION FOR design FROM ernie;
  1. +--------+---------+---------+
  2. | role | member | isAdmin |
  3. +--------+---------+---------+
  4. | design | barkley | false |
  5. | design | ernie | false |
  6. | design | lucky | false |
  7. +--------+---------+---------+

See also

Was this page helpful?
YesNo