I have a MySQL user and I want it to view ONLY the views I want and not any other table in the database. I've granted this user permissions only on certain views as following:
GRANT SHOW VIEW ON `myDatabase`.`awesome_view` TO 'thisUser'@'%'
If I do a show grants;
statement I can only see this permissions as expected.
However I'd like this user to query JUST the views and not the tables that are related to these views, but I can't find a way to do this. It seems to be that if I want the user to do a select on the view, the select must also be granted for the table, or am I wrong?
If I deny the select
statement in the rest of the tables, and in the command line I try to do a select I got the following:
SELECT * FROM myDatabase.fordibenForYouTable;
ERROR 1142 (42000): SELECT command denied to user 'thisUser'@'localhost' for table 'fordibenForYouTable'
That's what I want indeed, but I also got denied if I select the view data.
Is there a way I can make available to the user just the views and not the tables?