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.
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

WhatsApp