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
.