1.

What are Roles in MySQL and briefly explain any three

Answer»

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 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';


Discussion

No Comment Found