1146 🐬 MySQL

MySQL ERROR 1146 (42S02): Table 'db.table' doesn't exist

The query references a table that MySQL can’t find in that database.

Seen on: MySQL PHP WordPress

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 (Users vs users) on Linux
  • Table prefix differs (WordPress wp_ vs custom prefix)
  • InnoDB files copied without the system tablespace (corrupt data dir)

⚡ Quick fix

  1. SHOW TABLES; in the database the app uses
  2. Run migrations / import the schema
  3. Match table name case exactly
  4. Check the configured table prefix

Detailed fix by platform

PHP

  1. Laravel: php artisan migrate --force; check DB_DATABASE in .env.

WordPress

  1. Check $table_prefix in wp-config.php matches the actual tables.

How to diagnose

  1. Database — Which DB is selected?
  2. Tables — SHOW TABLES — present? Case?
  3. 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.