MySQL + SQL · Lesson 107
GRANT and REVOKE in MySQL
Controlling Access (DCL)
GRANT gives a user permissions; REVOKE takes them away. These are Data Control Language (DCL) commands.
Examples
-- give SELECT and INSERT on students to user1
GRANT SELECT, INSERT ON school.students TO 'user1'@'localhost';
-- take back INSERT
REVOKE INSERT ON school.students FROM 'user1'@'localhost';
Common Privileges
SELECT, INSERT, UPDATE, DELETE, ALL PRIVILEGES, CREATE, DROP.
Summary
- GRANT gives permissions; REVOKE removes them.
- Used by the DBA to control who can do what.