Common causes
- A SQL import stopped partway, so some tables were never created
- Wrong table prefix, such as $table_prefix = 'wp_' when tables use 'wp2_'
- The app connects to the wrong database
- Case mismatch: Users vs users on Linux where lower_case_table_names = 0
- Database migrations were not run (Laravel, Symfony, Django)
- 'doesn't exist in engine' means InnoDB data files are missing or out of sync
How to fix it
- List the tables that exist. Run SHOW TABLES FROM appdb; and compare the names to the one in the error, including prefix and letter case.
- Fix the prefix or database name. In WordPress, set $table_prefix in wp-config.php to the prefix your tables actually use. In other apps, check DB_DATABASE and any prefix setting in .env.
- Re-run the import. If tables are missing, re-import the dump and watch for the first error, for example mysql -u appuser -p appdb < backup.sql. A failure halfway skips every table after it.
- Run migrations. For framework apps run the migration command, such as php artisan migrate, so missing tables are created.
- Match the name's case. On Linux, table names are case-sensitive by default. Rename the table with RENAME TABLE Users TO users; or fix the query. lower_case_table_names can only be set when the MySQL 8 data directory is first initialized.
- Handle 'doesn't exist in engine'. This points to InnoDB damage, often after copying raw files from /var/lib/mysql. Restore the table from a proper SQL dump instead.
Check what tables exist and the prefix in use
SHOW TABLES FROM appdb LIKE '%options';
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'appdb'
ORDER BY table_name; How to stop it happening again
- Back up with mysqldump instead of copying raw data files
- Check import logs for errors before going live
- Use lowercase table names everywhere
- Keep the table prefix in config in sync after migrations