April 25, 2012

SELECT command denied to user

Question by dtj

Im getting a funny MySQL error. Here’s whats happening:

query:

SELECT COUNT(id) AS mycount FROM ip_protection.hits WHERE datetime_created>DATE_SUB(NOW(), INTERVAL 10 MINUTE) AND ip='166.248.6.19'

error:

SELECT command denied to user 'goatpric_db'@'166.248.6.19' for table 'hits'

privileges:

GRANT ALL PRIVILEGES ON `goatpric_ip_protection`.* TO 'goatpric_db'@'%'

‘hits’ is a table in ip_protection. Any thoughts?

Answer by Starx

You are using wrong database name everywhere. Use correct Database, which according to your question is ip_protection.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!