什么是 mysql 错误 (#1356)?
我创建一个视图:
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
然后创建补助金:
GRANT SELECT ON Teachprog.AuthorizationTrainer TO 'Trener'@'%'
SELECT id,nick FROM AuthorizationTrainer
- 有效
SELECT id,nick,pass FROM AuthorizationTrainer
- 产生错误:
飞行错误:#1356 - 查看
'Teachprog.AuthorizationTrainer'
引用无效表或 列或函数或视图的定义者/调用者缺乏使用它们的权限
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否检查了基础
TABLE2
和Person
表上的拨款?您可以授予对该视图所需的所有选择权限,但如果用户被阻止访问Person
中的pass
字段,您将收到此错误。要检查:Have you checked the grants on the underlying
TABLE2
andPerson
tables? You can grant all the select permissions you want on the view, but if the user is blocked from accessing thepass
field inPerson
, you'll get this error. To check:授予用户培训师选择表格的权限。您只授予了查看权限。
Grant user trainer permission to select the table. you have only given grant for view.