Reputation: 15378
I create a view:
CREATE OR REPLACE VIEW AuthorizationTrainer AS
SELECT Person.id, Person.login as nick, Person.password as pass
FROM TABLE2,Person
WHERE TABLE2.id_Person = Person.id
Then create grants:
GRANT SELECT ON Teachprog.AuthorizationTrainer TO 'Trener'@'%'
SELECT id,nick FROM AuthorizationTrainer
- works
SELECT id,nick,pass FROM AuthorizationTrainer
- produces the error:
fly error: #1356 - View
'Teachprog.AuthorizationTrainer'
references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
Upvotes: 1
Views: 10513
Reputation: 659
Grant user trainer permission to select the table. you have only given grant for view.
grant select on Teachprog.TABLE2,Person to 'Trener'@'%' ;
grant select on Teachprog.Person to 'Trener'@'%' ;
Upvotes: 0
Reputation: 360682
Have you checked the grants on the underlying TABLE2
and Person
tables? You can grant all the select permissions you want on the view, but if the user is blocked from accessing the pass
field in Person
, you'll get this error. To check:
show grants for trener@%
Upvotes: 1