0
0
MySQLquery~5 mins

Revoking privileges in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the REVOKE command do in MySQL?
The REVOKE command removes specific privileges from a user, stopping them from performing certain actions on the database.
Click to reveal answer
beginner
Syntax of REVOKE command to remove SELECT privilege on a database from a user.
REVOKE SELECT ON database_name.* FROM 'username'@'host';
Click to reveal answer
intermediate
Can you revoke multiple privileges at once in MySQL? How?
Yes, you can revoke multiple privileges by listing them separated by commas, for example: REVOKE SELECT, INSERT ON db.* FROM 'user'@'host';
Click to reveal answer
beginner
What happens if you revoke all privileges from a user?
The user loses all the specified permissions and cannot perform any actions on the database objects for which privileges were revoked.
Click to reveal answer
intermediate
Why is it important to revoke privileges carefully?
Revoking privileges carefully ensures users only have access they need, improving security and preventing accidental or malicious data changes.
Click to reveal answer
Which command removes privileges from a MySQL user?
AREVOKE
BGRANT
CDELETE
DDROP
How do you revoke the INSERT privilege on all tables in a database named 'shop' from user 'alice'?
AGRANT INSERT ON shop.* TO 'alice'@'localhost';
BREVOKE INSERT ON shop.* FROM 'alice'@'localhost';
CREVOKE INSERT ON shop FROM 'alice';
DDROP USER 'alice'@'localhost';
Can you revoke privileges from a user that does not have them?
AYes, it will silently succeed.
BNo, it causes an error.
CYes, but only for SELECT privilege.
DNo, you must grant first.
Which of these is NOT a valid privilege to revoke?
AUPDATE
BINSERT
CCREATE USER
DSELECT
What is the effect of revoking ALL PRIVILEGES from a user?
AUser is deleted.
BUser can still read data.
CUser can still write data.
DUser loses all database permissions.
Explain how to revoke the SELECT and UPDATE privileges from a user on a specific database in MySQL.
Think about how to list privileges separated by commas and specify the user with host.
You got /3 concepts.
    Why is it important to manage user privileges carefully using REVOKE in a database system?
    Consider what could happen if users have more access than needed.
    You got /4 concepts.