Mysql:执行命令拒绝用户''@'localhost' 例行错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6434573/
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
Mysql: execute command denied to user ''@'localhost' for routine error
提问by nunu
i got some problem during open my old website. My dataTable show:
我在打开旧网站时遇到了一些问题。我的数据表显示:
DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
After that, I tried to debug my script and found error in mysql:
之后,我尝试调试我的脚本并在 mysql 中发现错误:
Error occuered during query execution:
(<small>SELECT SQL_CALC_FOUND_ROWS ID,name,remark,avrusepmonth
, CONCAT('<input type=''checkbox''id=''cb' , ID ,''' name=''check[]''
value=''',ID,''' >','<label class=''lbcb'' for=''cb',
ID,'''><=update=</label>') as checkb
,monthavrage(ID,12) as latestavr , moq, leadtime
FROM test_media WHERE nowuse=1 and monthavrage(ID,12) > 0 ORDER BY name
desc, ID
LIMIT 0, 10</small>):
execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage'
Then I tried to googling for execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage'
and some sites said that I must do some GRANT
:
然后我试着用谷歌搜索execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage'
,有些网站说我必须做一些GRANT
:
GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost'
but I got:
但我得到了:
#1370 - execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage'
could you tell me how should I do for solving this?
你能告诉我我该怎么做才能解决这个问题吗?
回答by nunu
It works.....
I try to grant this priviledge in root
.
它有效..... 我尝试在root
.
- log in as
root
GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost'
flush privileges;
- 登录为
root
GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost'
flush privileges;
回答by Sydwell
Very late to the party also try a combination of.
很晚的聚会也尝试了组合。
GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'%';
AND
和
flush privileges;
Also try replacing PROCEDURE with FUNCTION.
也可以尝试用 FUNCTION 替换 PROCEDURE。
回答by Max Izrin
I have encountered this in phpMyAdmin, a few hours ago, when executing a stored procedure with what I thought would be detected as a syntax error.
几个小时前,我在 phpMyAdmin 中遇到过这个问题,当时执行存储过程时我认为会被检测为语法错误。
I was missing a comma between a field name, and a calculated field, and this gave me the same error message.
我在字段名称和计算字段之间缺少逗号,这给了我相同的错误消息。
回答by IonV
I encountered this yesterday, I expected a syntax error but this message was shown.
我昨天遇到了这个,我预计会出现语法错误,但显示了此消息。
My mistake: I wrote "SELECT m.id, m.MAX(id_number) as id_number..." instead of "SELECT m.id, MAX(m.id_number) as id_number...".... the error is with the MAX. The error message wasn't too helpful.
我的错误:我写了“SELECT m.id, m.MAX(id_number) as id_number...”而不是“SELECT m.id, MAX(m.id_number) as id_number...”...错误是与 MAX。错误消息并没有太大帮助。