# MySQL ERROR 1142 (42000): SELECT command denied to user 'x'@'host' for table 'y'

**Code:** `1142` · **Category:** MySQL · **Seen on:** MySQL

The account lacks the privilege for that statement on that table.

## 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

1. GRANT the needed privileges
2. Use separate migration and app users deliberately
3. Check SHOW GRANTS

## Detailed fix by platform

### MySQL

1. `GRANT SELECT, INSERT, UPDATE, DELETE ON appdb.* TO 'app'@'%';`

## How to diagnose

1. **Privilege** — Which command?
2. **Grants** — SHOW GRANTS FOR user

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/mysql/1142-command-denied-to-user)
