One of the most frequently posed MYSQL query interview questions, be ready for it.   A MySQL role is a named collection of privileges. Like user accounts, roles can have privileges granted to and revoked from them. A user account can be granted roles, which grants to the account the privileges associated with each role. This enables the assignment of sets of privileges to accounts and provides a convenient alternative to granting individual privileges, both for conceptualizing desired privilege assignments and implementing them. CREATE ROLE and DROP ROLE enable roles to be created and removed. CREATE ROLE ‘admin’, ‘devops’;
DROP ROLE ‘admin’, ‘devops’; GRANT and REVOKE enable privilege assignment and revocation for user accounts and roles. GRANT ALL ON db1.* TO ‘admin’@’localhost’;
REVOKE INSERT ON *.* FROM ‘admin’@’localhost’; SHOW GRANTS displays privilege and role assignments for user accounts and roles. SHOW GRANTS FOR 'admin'@'localhost';