MySQL Privilege Restriction Using Partial Revokes
Posted by: yu zhang
Date: November 22, 2021 10:02PM

MySQL version 5.7.32。



I have a user 'test'@'%' in MySQL database.

mysql> show grants for test;

+--------------------------------------------------------------------------------+

| Grants for test@% |

+--------------------------------------------------------------------------------+

| GRANT SELECT ON *.* TO 'test'@'%' |

+--------------------------------------------------------------------------------+



mysql> desc employees.salaries;

+-----------+---------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-----------+---------+------+-----+---------+-------+

| emp_no | int(11) | NO | PRI | NULL | |

| salary | int(11) | NO | | NULL | |

| from_date | date | NO | PRI | NULL | |

| to_date | date | NO | | NULL | |

+-----------+---------+------+-----+---------+-------+



I want to revoke select privilege which on employees.salaries.salary.

mysql> revoke select(salary) on employees.salaries from test;

ERROR 1147 (42000): There is no such grant defined for user 'test' on host '%' on table 'salaries'



This privilege Cannot be revoked directly.

Is there any other way to achieve?

Thanks!

Options: ReplyQuote


Subject
Written By
Posted
MySQL Privilege Restriction Using Partial Revokes
November 22, 2021 10:02PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.