MySQL ERROR 1142 (42000): SELECT command denied to user 'x'@'host' for table 'y'
The account lacks the privilege for that statement on that table.
Exact message you may see
command denied to user
Seen on:
MySQL
Meaning
Users often have privileges on one database but not another, or lack ALTER/CREATE/TRIGGER needed by migrations.
Common causes
- Missing GRANT for the statement type
- Privileges on a different database
- Views/triggers needing extra privileges
⚡ Quick fix
- GRANT the needed privileges
- Use separate migration and app users deliberately
- Check SHOW GRANTS
Detailed fix by platform
MySQL
GRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO 'app'@'%';
How to diagnose
- Privilege — Which command?
- Grants — SHOW GRANTS FOR user
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in MySQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 15 Oct 2026