MySQL Error: #1142 - SELECT command denied to user

感情迁移 提交于 2019-11-27 13:55:59
khaled_webdev

You need to grant SELECT permissions to the MySQL user who is connecting to MySQL

same question as here Error: select command denied to user '<userid>'@'<ip-address>' for table '<table-name>'

see answers of the link ;)

I faced the same situation but its funny that reason for the error was due to the use of the incorrect database or schema name.

Its true that multiple issues can lead to error you have mentioned.

This error also arises for a syntax error occurred due to aliasing tablename.

For instance, when executed below query,

select * from a.table1, b.table2 where a.table1= b.table2

below error occurs:

MySQL Error: #1142. Response form the database. SELECT command denied to user "username@ip" for table "table1"

Solution : Syntax to alias tablename should be used proper, syntax solution for above instance >select * from table1 a, table2 b where a.table1= b.table2

I had this problem too and for me, the problem was that I moved to a new server and the database I was trying to connect to with my PHP code changed from "my_Database" to "my_database".

This is th privileges issue in your database users. first check and grant permission to user 'marco' in localhost

So the issue I ran into was this... the application I used to grant the permissions converted the Schema.TableName into a single DB statement in the wrong table, so the grant was indeed wrong, but looked correct when we did a SHOW GRANTS FOR UserName if you weren't paying very close attention to GRANT SELECT vs GRANT TABLE SELECT. Manually correcting the Grant Select on Table w/ proper escaping of Schema.Table solved my issue.

May be unrelated, but I can imagine if one client does this wrong, another might too.

Hope that's helpful.

In MySQL query browser go to Tools tab>MySQL Administrator > User Administration and then give the privileges to user.

it's about the privallage of user in the mysql,so you should set the bigger grants with your users.

do this !

In the Terminal, put code mysql> show grants;

then change the following code like this :

GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*3F9DF5A32114E05C12C50A83EAE02991016C917B' WITH GRANT OPTION;

Then it will be done.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!