Link to home
Start Free TrialLog in
Avatar of slightlyoff
slightlyoff

asked on

Access denied; you need the RELOAD privilege for this operation

I'm new to PHP and MySQL..

I get the following error when I do the "Flush Privileges" statement:  Access denied; you need the RELOAD privilege for this operation

It actually does to the insert statement above - I don't know if I need the "Flush Privileges" or not, but it was part of the example, and it seems like clearing out the settings on the server was a good idea (if i understand what flushing does correctly)

I created a database using MySQL WorkBench - but i forgot to put an Auto_Increment on the primary key, so I had to add it later.  After adding it, the error started coming up.  I created a whole new table, just to see if it was related to the table, but it's doing it on the new table.

Thanks for your help!!!

<?php
include 'data/config.php';
include 'data/opendb.php';

$query = "INSERT INTO myTable (Name) VALUES ('Name')";
mysql_query($query) or die('Error, insert query failed - 1' . mysql_error());

//This is the error section...

$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, query failed - 2' . mysql_error());

include 'data/closedb.php';
echo "New MySQL user added";


?>

Open in new window

Avatar of Swafnil
Swafnil
Flag of Germany image

I haven't found a clear statement that auto_increments cause an implicit flush table but have you checked if the user you are currently inserting data with has the RELOAD privilege?

Please post the result of the following command to see what's exactly causing the above error:
SHOW GRANTS;

Open in new window

Avatar of slightlyoff
slightlyoff

ASKER

Thanks for your quick reply, I won't be back to the project until tomorrow - I'll keep you posted on what I get.

Thanks again!!!
Here's what I got:

'GRANT USAGE ON *.* TO ''myuser''@''%'' IDENTIFIED BY PASSWORD ''xxxxxxxxxxxxx''''
GRANT ALL PRIVILEGES ON `mytable`.* TO ''myuser''@''%'' WITH GRANT OPTION'

I ran the command inside of MySQL WorkBench...

Thanks for your help!
ASKER CERTIFIED SOLUTION
Avatar of Swafnil
Swafnil
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help.  Turns out I don't have the permissions to do that.  So, it's all good.  Thanks for your help!