SELECT command denied to user

2
  

Error: SELECT command denied to user 'bank'@'xxx.xx.xx.xx' for table '

This error only happens in my hosting, it is running locally perfectly, I am querying 2 databases in a single query using:

 'banco'.'table' ... 

Is it user permissions? If yes, how can I release the permission, remembering that it is hosting?

    
asked by anonymous 05.07.2014 / 03:40

1 answer

6

This error is generated when you are trying to access a database with a user who does not have permissions on it.

For your particular case, the user you are trying to access does not have permissions to run SELECT on that database.

Confirm that the user exists and has permissions to access the database, if not, you must create a user and associate the same with the database in question.

The way to create the user and associate the same to the database will depend on your hosting, but you certainly have access to a cPanel administration panel where you can access to create mail accounts, databases and their users.

In exceptional cases, it has already been reported in SOEN than in queries that work with two or more tables and:

  • one of them does not exist;
  • or there is an error in SELECT where the table name is misspelled

MySQL, instead of giving the indication that the table does not exist, displays the user's lack of permissions error message against the SELECT running.

Also confirm that the tables exist in your hosting database.

    
05.07.2014 / 04:29