mysql 无权限创建视图,在phpMyAdmin中创建没有超级权限的视图

I am trying to via SQL tab within the phpmyadmin to create/import a view like this:

CREATE ALGORITHM=UNDEFINED DEFINER=`byname`@`localhost` SQL SECURITY DEFINER VIEW `wr_averages` AS select `nf_users`.`id` AS `id`,(`nf_users`.`points` / `nf_users`.`played`) AS `average_points` from `nf_users` where (`nf_users`.`played` > 24);

I get this error:

#1227 - Access denied; you need the SUPER privilege for this operation

I can not get SUPER privileges at my hosting company, so is there anyway to get around this?

Thanks in advance :-)

解决方案

From the documentation:

If you specify the DEFINER clause, you cannot set the value to any user but your own unless you have the SUPER privilege. These rules determine the legal DEFINER user values:

*If you do not have the SUPER privilege, the only legal user value is your own account, either specified literally or by using CURRENT_USER. You cannot set the definer to some other account.*

If you have the SUPER privilege, you can specify any syntactically legal account name. If the account does not actually exist, a warning is generated.

Check your MySQL account, it is not byname@localhost.

Solutions:

Create new view with DEFINER clause using account that granted with SUPER privilege.

Do not use DEFINER clause in CREATE VIEW, in this case MySQL will create view DEFINER = CURRENT_USER.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值