开发者

What is error mysql (#1356)?

开发者 https://www.devze.com 2023-02-01 19:21 出处:网络
I create a view: CREATE OR REPLACE VIEW AuthorizationTrainer AS 开发者_StackOverflow SELECT Person.id, Person.login as nick, Person.password as pass

I create a view:

CREATE OR REPLACE VIEW AuthorizationTrainer AS 
 开发者_StackOverflow 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


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@%  


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'@'%' ;
0

精彩评论

暂无评论...
验证码 换一张
取 消