MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist
The query references a table that MySQL can’t find in that database.
Meaning
Either the table genuinely doesn’t exist (migrations not run, wrong database selected) or the name differs in case — on Linux, table names are case-sensitive by default (lower_case_table_names=0).
Common causes
- Migrations/schema import not run on this environment
- Connected to the wrong database
- Case mismatch (
Usersvsusers) on Linux - Table prefix differs (WordPress
wp_vs custom prefix) - InnoDB files copied without the system tablespace (corrupt data dir)
⚡ Quick fix
SHOW TABLES;in the database the app uses- Run migrations / import the schema
- Match table name case exactly
- Check the configured table prefix
Detailed fix by platform
PHP
- Laravel:
php artisan migrate --force; checkDB_DATABASEin .env.
WordPress
- Check
$table_prefixin wp-config.php matches the actual tables.
How to diagnose
- Database — Which DB is selected?
- Tables — SHOW TABLES — present? Case?
- Migrations — Run on this environment?
🧠 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