This is a two part exercise. The first part is a quiz about MySQL syntax with respect to privileges. The second part consists of granting and revoking privileges to MySQL users.
help;.mysql database.mysql>use mysql;
GRANT statement to create a user called 'vet', with password 'newpw', who has access to SELECT, UPDATE, INSERT, and DELETE on the pet table.mysql>grant select, update, insert, delete
->on pet.pet to vet
->identified by 'newpw';
mysql>SHOW GRANTS FOR 'vet'@'localhost';
vet to doc.
mysql>RENAME USER vet TO doc;
user table.mysql>SHOW COLUMNS FROM mysql;
GRANT statement, grant all privileges by creating an entry for nurse@localhost in the user table.mysql>INSERT INTO user VALUES('localhost','nurse',PASSWORD('newpw'),
->'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
->'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y',
->'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
mysql>SHOW GRANTS FOR 'nurse'@'localhost';
Why weren't the privileges granted?
mysql>FLUSH PRIVILEGES;
mysql>SHOW GRANTS FOR 'nurse'@'localhost';
REVOKE statement to remove this user's privileges.mysql>revoke select, update, insert, delete
->on pet.pet from doc;
DROP statement to remove nurse as a user.mysql>DROP USER nurse@localhost
QUIT to exit out of the server.
mysql>QUIT
Congratulations! You have successfully granted and revoked MySQL privileges.