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.
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026