Hello, I am currently having an issue with MySQL!
您好,我目前遇到MySQL问题!
What's going wrong here? I am a cPanel user, 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用户,是的,我搜索了这个,没有找到明确的答案。看起来这比具有相同错误代码问题的其他人更具体。请添加我可以遵循的详细回复! P.s我正在使用共享主机帐户。
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
3 个解决方案
#1
23
It means you don't have privileges to create the trigger with root@localhost user..
这意味着您没有权限使用root @ localhost用户创建触发器。
try removing definer from the trigger command:
尝试从触发器命令中删除definer:
CREATE DEFINER = root
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = root @ localhost功能fnc_calcWalkedDistance
#2
9
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文件,那么尝试用你的sql文件中的cpanel用户名替换root。
in the case above you could write
在上面的情况下你可以写
CREATE DEFINER = control_panel_username
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = control_panel_username @ localhost功能fnc_calcWalkedDistance
then upload the file. Hope it helps
然后上传文件。希望能帮助到你
#3
0
Simply remove "DEFINER=your user name
@localhost
" and run the SQL from phpmyadminwill works fine.
只需删除“DEFINER =您的用户名@ localhost”并从phpmyadmin运行SQL即可正常工作。
#1
23
It means you don't have privileges to create the trigger with root@localhost user..
这意味着您没有权限使用root @ localhost用户创建触发器。
try removing definer from the trigger command:
尝试从触发器命令中删除definer:
CREATE DEFINER = root
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = root @ localhost功能fnc_calcWalkedDistance
#2
9
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文件,那么尝试用你的sql文件中的cpanel用户名替换root。
in the case above you could write
在上面的情况下你可以写
CREATE DEFINER = control_panel_username
@localhost
FUNCTION fnc_calcWalkedDistance
CREATE DEFINER = control_panel_username @ localhost功能fnc_calcWalkedDistance
then upload the file. Hope it helps
然后上传文件。希望能帮助到你
#3
0
Simply remove "DEFINER=your user name
@localhost
" and run the SQL from phpmyadminwill works fine.
只需删除“DEFINER =您的用户名@ localhost”并从phpmyadmin运行SQL即可正常工作。