2011-06-22 97 views
18

我在打開我的舊網站時遇到了一些問題。我的dataTable顯示:Mysql:執行命令拒絕用戶''@'localhost'的例程錯誤

DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error. 

在那之後,我試圖調試我的腳本和MySQL中的錯誤:

Error occuered during query execution: 
(<small>SELECT SQL_CALC_FOUND_ROWS ID,name,remark,avrusepmonth 
     , CONCAT('&lt;input type=''checkbox''id=''cb' , ID ,''' name=''check[]''     
     value=''',ID,''' &gt;','&lt;label class=''lbcb'' for=''cb', 
     ID,'''&gt;&lt;=update=&lt;/label&gt;') as checkb 
     ,monthavrage(ID,12) as latestavr , moq, leadtime 
     FROM test_media WHERE nowuse=1 and monthavrage(ID,12) &gt; 0 ORDER BY name 
     desc, ID 
     LIMIT 0, 10</small>): 
execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage' 

然後我試圖google搜索execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage'和一些網站說,我必須做一些GRANT

GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost' 

但我得到:

#1370 - execute command denied to user 'jeinqa'@'localhost' for routine 'TestMediaControl.monthavrage' 

你能告訴我該如何解決這個問題?

回答

25

它的工作..... 我試圖授予這個特權root

  1. 日誌中爲root
  2. GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost'
  3. flush privileges;
8

非常遲到了也儘量的組合。

GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'%'; 

flush privileges; 

也可以嘗試用FUNCTION更換步驟。

1

幾個小時前,我在phpMyAdmin中遇到過這個問題,那時執行的存儲過程與我認爲會被檢測爲語法錯誤的情況相同。

我錯過了一個字段名稱和一個計算字段之間的逗號,這給了我同樣的錯誤信息。

相關問題