Name

REVOKE

Synopsis

REVOKE ALL PRIVILEGES, GRANT OPTION FROM user[,  . . . ]

REVOKE privileges [(column,  . . . )] 
   ON table.database 
   FROM user[,  . . . ]

Use this statement to revoke all or certain privileges that were granted to a user with the GRANT statement. The first syntax structure is used to revoke all privileges from a user. Multiple users may be given in a comma-separated list. A list of users and their privileges are stored in the mysql database, in particular in the user table.

To revoke only some privileges, you can use the second syntax structure. The specific privileges are to be given in a comma-separated list after the keyword REVOKE. To revoke privileges for specific columns, those columns may be listed within parentheses in a comma-separated list. Privileges that are granted based on columns are stored in the columns_priv table of the mysql database. Privileges may be revoked on a specific table for a specific database. To revoke privileges on all tables of a database, the table name should be substituted with an asterisk as a wildcard. You can do the same for the database name for the statement to apply to all databases. Table-specific privileges are stored in the tables_priv table, and database privileges are stored in the db table.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.