update command is denied for user

pahnin picture pahnin · Nov 2, 2011 · Viewed 55.4k times · Source

I've been using this free hosting site for development and testing.

I couldn't use an UPDATE MySQL command to change the database values, even though the user is supposed to be allowed to use all commands from cPanel.

Then, I've tested the same with a default user, it still won't work. However, it works fine on my system.

The MySQL error is

UPDATE command denied to user 'test'@'localhost' for table 'content'

Other commands are working fine.

Why is this happening? And how can it be prevented? Or any solution for this?

And I am very sure that users have permission to use the UPDATE command because I can use phpMyAdmin with the same user and modify the MySQL fields.

I don't understand why some MySQL commands from PHP are denied for a user who was given all priviliges and can do everything via phpMyAdmin. Given that script, phpMyAdmin and the SQL host are on the same server.

Answer

pahnin picture pahnin · Feb 19, 2012

For everyone who have tried answering this question here is my sincere thanks. I have found the problem and solution.

my sql query is like this

UPDATE `dblayer`.`test` SET `title` = 'hello a' WHERE `test`.`id` =1;

which I got from phpmyadmin and it works perfectly on my system. But when I work on the servers it doesn't work and it says command denied may be because

`dblayer`.`test`

I am trying to select the table globally (or something like that, I'm not sure) but if my sql query is

UPDATE `test` SET `title` = 'hello a' WHERE `test`.`id` =1;

it works on my server too.