38

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:

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?

nunu
  • 2,703
  • 9
  • 33
  • 55

5 Answers5

51

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;
biniam
  • 8,099
  • 9
  • 49
  • 58
nunu
  • 2,703
  • 9
  • 33
  • 55
18

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.

Sydwell
  • 4,954
  • 1
  • 33
  • 36
8

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.

Max Izrin
  • 938
  • 1
  • 11
  • 17
  • 2
    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) – Krunal Nov 05 '18 at 05:00
1

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.

kat
  • 21
  • 1
-2

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.

IonV
  • 37
  • 6
  • 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 Apr 11 '20 at 08:55
  • @Marcinek This seems to me like another situation where the mentioned error may confusingly occur, and how to fix it by fixing the SQL. – Scratte Apr 11 '20 at 09:20