SELECT command denied to user user@host for Table table

Problem

You get the following error when connecting to a MySQL database:

SELECT command denied to user ‘user@host’ for Table ‘table’

You may need to change your MySQL configuration and the database to allow permissions for each user.

Solution

Step 1:  Give users the ability to access from any IP Address by using a command such as:

update User set Host='%' where user='{MYSQL-USERNAME}';

See: http://www.geekology.co.za/blog/2009/06/enabling-remote-access-to-mysql-database-server/

Step 2:  Give users permission to access the specific database by using a command such as:

GRANT ALL ON *.* TO 'user2'@'localhost' IDENTIFIED BY 'pass1';

See: http://www.databasef1.com/tutorial/mysql-create-user.html

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages