Revoking grants

Revoking grants has the same syntax as creating grants. You grant a privilege TO the user and revoke a privilege FROM the user.

  • Revoke the DELETE access from the 'company_write'@'%' user:
mysql> REVOKE DELETE ON company.* FROM 'company_write'@'%';Query OK, 0 rows affected (0.04 sec)
  • Revoke the access to the salary column from the employee_ro user:
mysql> REVOKE SELECT(salary) ON employees.salaries FROM 'employees_ro'@'%';Query OK, 0 rows affected (0.03 sec)

Get MySQL 8 Cookbook 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.