0
0
MySQLquery~5 mins

Role-based access in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is role-based access control (RBAC) in databases?
RBAC is a method to restrict database access based on user roles. Each role has specific permissions, and users get access by being assigned to roles.
Click to reveal answer
beginner
How do you create a role in MySQL?
Use the statement: CREATE ROLE 'role_name'; to create a new role.
Click to reveal answer
intermediate
How do you assign privileges to a role in MySQL?
Use GRANT privilege ON database.table TO 'role_name'; to give permissions to a role.
Click to reveal answer
intermediate
How do you assign a role to a user in MySQL?
Use GRANT 'role_name' TO 'user'@'host'; to assign a role to a user.
Click to reveal answer
intermediate
What command activates a role for the current session in MySQL?
Use SET ROLE 'role_name'; to activate the role's privileges in your session.
Click to reveal answer
Which command creates a new role in MySQL?
ASET ROLE 'manager';
BCREATE USER 'manager';
CGRANT ROLE 'manager';
DCREATE ROLE 'manager';
How do you give SELECT permission on a table to a role?
AGRANT SELECT ON database.table TO 'role_name';
BCREATE ROLE SELECT ON database.table;
CSET ROLE SELECT ON database.table;
DASSIGN SELECT TO 'role_name';
What command assigns a role to a user?
ACREATE USER 'user' WITH ROLE 'role_name';
BSET ROLE 'role_name' FOR 'user';
CGRANT 'role_name' TO 'user'@'host';
DASSIGN ROLE 'role_name' TO 'user';
How does a user activate a role's privileges in their session?
ACREATE ROLE 'role_name';
BSET ROLE 'role_name';
CGRANT ROLE 'role_name';
DUSE ROLE 'role_name';
Which of these is NOT true about roles in MySQL?
ARoles automatically activate for all users without SET ROLE.
BUsers can be assigned multiple roles.
CRoles can have privileges assigned.
DRoles simplify privilege management.
Explain how role-based access control works in MySQL and why it is useful.
Think about how grouping permissions into roles helps manage many users.
You got /6 concepts.
    Describe the steps to create a role, assign privileges, and enable a user to use that role in MySQL.
    Focus on the sequence of commands from role creation to user activation.
    You got /4 concepts.