MySQL #1227 - 访问被拒绝;您需要(至少其中之一)此操作的 SUPER 权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31315660/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
提问by Lachie
Hello, I am currently having an issue with MySQL!
您好,我目前在使用 MySQL 时遇到问题!
What's going wrong here? I am a cPaneluser, and yes I have searched this and found no definitive answers. It appears this is more specific than other people with the same error codes issues. Please add a detailed response that I can follow along with! P.s I am using a shared hosting account.
这里出了什么问题?我是cPanel用户,是的,我已经搜索过这个,但没有找到明确的答案。看起来这比其他具有相同错误代码问题的人更具体。请添加我可以跟随的详细回复!Ps 我使用的是共享主机帐户。
DELIMITER $$--
-- Functions
--
CREATE DEFINER = `root`@`localhost` FUNCTION `fnc_calcWalkedDistance` (
`steamid64` BIGINT UNSIGNED
) RETURNS INT( 10 ) UNSIGNEDNO SQL BEGIN DECLARE finished INTEGER DEFAULT 0;
DECLARE distance INTEGER DEFAULT 0;
DECLARE x1, x2, z1, z2 FLOAT;
DECLARE curs CURSOR FOR SELECT x, z
FROM log_positions
WHERE `steamid` = steamid64
ORDER BY `timestamp` DESC ;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET finished =1;
OPEN curs;
FETCH curs INTO x1, z1;
SET x2 = x1;
SET z2 = z1;
calculate : LOOPFETCH curs INTO x1, z1;
IF finished =1 THEN LEAVE calculate;
END IF ;
SET distance = distance + SQRT( POW( x2 - x1, 2 ) + POW( z2 - z1, 2 ) ) ;
-- SET distance = distance + 1;
SET x2 = x1;
SET z2 = z1;
END LOOP calculate;
CLOSE curs;
RETURN distance;
END$$
Here is the error code:
这是错误代码:
MySQL said: Documentation
#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
回答by Aman Aggarwal
It means you don't have privileges to create the trigger with root@localhostuser..
这意味着您无权使用root@localhost用户创建触发器。
try removing definer from the trigger command:
尝试从触发器命令中删除定义器:
CREATE DEFINER = root
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = root
@localhost
FUNCTION fnc_calcWalkedDistance
回答by Shafiq
Simply remove "DEFINER=your user name
@localhost
" and run the SQL from phpmyadminwill works fine.
只需删除“DEFINER = your user name
@ localhost
”并从phpmyadmin运行SQL即可正常工作。
回答by Junior_swashluv
This might come in a little late but in case you are uploading an sql file on cpanel, then try and replace root with your cpanel username in your sql file.
这可能会晚一些,但如果您在 cpanel 上上传 sql 文件,请尝试将 root 替换为您的 sql 文件中的 cpanel 用户名。
in the case above you could write
在上面的情况下,你可以写
CREATE DEFINER = control_panel_username
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = control_panel_username
@ localhost
FUNCTION fnc_calcWalkedDistance
then upload the file. Hope it helps
然后上传文件。希望能帮助到你
回答by Muhammad Waqas
remove DEFINER=root
@localhost
from all calls including procedures
从包括过程在内的所有调用中删除 DEFINER= root
@localhost