45

I have 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:

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'

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:

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?

0

7 Answers 7

53

It works..... I try to grant this priviledge in root.

  1. log in as root
  2. GRANT EXECUTE ON PROCEDURE TestMediaControl.monthavrage TO 'jeinqa'@'localhost'
  3. flush privileges;
Sign up to request clarification or add additional context in comments.

Comments

19

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.

Comments

9

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.

I was missing a comma between a field name, and a calculated field, and this gave me the same error message.

1 Comment

Ha ha, this is not a technical solution for problem but a solution to syntax error and I had a same problem that I could solved using this one... Great....! (I wish I could give 2 upvotes to this answer)
4

I got the same error when trying to use the MIN function in my query.

Error Code: 1370. execute command denied to user 'a.user'@'%' for routine 'mysqlserver.MIN'

MySQL didn't like seeing a space before MIN and the opening (.

After reading the above and trying MIN(..) instead of MIN (..) my query worked.

Go figure.

1 Comment

+1 That was my issue as well. When executing the same statement with "COUNT" via PhpMyAdmin's SQL "console", you get no error. But when executed as my own PHP script, I get that strange error. Removing the white space solves the issue.
3

I had the problem too - my error was quoting was with routine count - access denied.

The problem was I had "count (case when...)" and there cannot be a space between count and (. removing spaces fixed the error.

2 Comments

This is pretty weird as I already had the privileges. But this worked for me! None of the answers did, thanks
Yes, this was exactly my issue. This is an answer to the question.
-1

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.

2 Comments

This seems to be a follow up question. Maybe it would be better to post this as a comment, rather than a question. If you have a question please start a new one.
@Marcinek This seems to me like another situation where the mentioned error may confusingly occur, and how to fix it by fixing the SQL.
-1

Very very late to the party. I also committed a syntax mistake and got the same error. I used a space between my MAX function - MAX (ABC). Got it working after removing the space MAX(ABC).

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.