About The Author

This is a sample info about the author. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis.

Get The Latest News

Sign up to receive latest news

Wednesday 24 August 2011

MySQL Revoke Command Syntax And Example

The opposite of GRANT is REVOKE. It is used to take privileges away from a user. It is very similar to GRANT in syntax. The REVOKE command is used to rescind privileges previously granted to a user.
Syntax:
REVOKE priv_type [(column_list)] [, priv_type [(column_list)] ...]
ON {tbl_name | * | *.* | db_name.*}
FROM user_name [, user_name …]

To revoke the SELECT persmission from the “payroll” database:
REVOKE SELECT ON payroll.* FROM 'iics'@'localhost';

To revoke the DELETE persmission from the “student” table from “school” database:
REVOKE DELETE ON school.student FROM 'iics'@'localhost';

To revoke the ALL privileges from the “school” database:
REVOKE ALL PRIVILEGES ON school.* FROM 'kaushal'@'localhost';

To revoke the all privileges from the “hospital” database:
REVOKE ALL ON hospital.* FROM 'iics'@'localhost';

To revoke MULTIPLE Privileges to all tables of customer database:
REVOKE SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON customer.* FROM 'iics'@'localhost';

To revoke the all privileges from the all databases and tables:
REVOKE ALL ON *.* FROM 'iics'@'localhost';

To Revoke INSERT,SELECT Privileges to specific columns of the tables:
REVOKE SELECT (col1), INSERT (col1,col2) ON mydb.mytbl TO 'iics'@'localhost';

0 comments:

Post a Comment