I’m running some tests and I’m trying to see if I can create a user with access to only 1 or 2 tables in my db. Does anyone know how this is done? My code below fails:
GRANT SELECT ON testdb.fruits, testdb.sports TO joe@localhost IDENTIFIED BY 'pass';
The error says I have an error in my syntax.
Run them as two individual
GRANTstatements:The MySQL GRANT syntax only permits one object in the
priv_levelposition:, though it may use a*as a wildcard:The part below does not appear to work on MySQL 5.5. How to “subtract” privileges in MySQL addresses why.
To grantSELECTon all tables then selectively revoke, you could do:This seems to be an odd method though, and I think I would individually GRANT rather than individually REVOKE.