Skip to content
Databases2 min read

Fix MySQL error 1146: Table doesn't exist

ERROR 1146 (42S02): Table 'cpuser_shop.wp_options' doesn't exist

Short answer

Error 1146 means your app connected to the database successfully, but the table named in the message isn't in it. Common causes are an import that didn't finish, a wrong WordPress table prefix, a letter-case mismatch in the table name, or a connection to the wrong database.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Causes
  2. How to fix it
  3. Prevention
  4. On ArabyHost

The connection and login worked and the database exists, but the table you asked for isn’t in it. The message names both the database and the table, which is your best clue: in the example, cpuser_shop is the database and wp_options the table. In Laravel it usually reads:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cpuser_shop.users' doesn't exist

Causes

  • An incomplete import: the import stopped on file size or a timeout, so only some tables arrived.
  • A wrong table prefix: wp-config.php says $table_prefix = 'wp_'; but the tables start with wpx7_.
  • Letter case: on Linux, Users and users are different tables. A dump exported on Windows may have lowercase names while the code uses capitals.
  • The wrong database: your config points to an old or empty database.
  • Migrations not run on a freshly deployed Laravel project.
  • A damaged table: its files are missing, often with error 1932 Table doesn't exist in engine.

How to fix it

  1. List the tables that exist, by selecting the database in phpMyAdmin’s sidebar or in the SQL tab:
SHOW TABLES;
SHOW TABLES LIKE '%options';
  1. Compare the database name in the error with DB_DATABASE or DB_NAME in your config, and correct it if it differs.

  2. Fix the WordPress prefix. If the tables start with wpx7_, set this in wp-config.php:

$table_prefix = 'wpx7_';
  1. Finish an incomplete import. Check that the dump actually contains the missing table:
grep -c "CREATE TABLE" backup.sql
grep "CREATE TABLE \`wp_options\`" backup.sql

Then import the whole file into an empty database. If it’s large and keeps stopping, see phpMyAdmin import file too large.

  1. Make the case match. Rename the table to match the code, or change the code to match the table:
RENAME TABLE Users TO users;
  1. Run Laravel migrations over SSH:
php artisan migrate:status
php artisan migrate --force

--force is needed because Laravel won’t run migrations in production without confirmation.

  1. For a damaged table reporting Table doesn't exist in engine, don’t copy database files around by hand; restore the database from a backup.

Prevention

  • After every import, compare the table count between source and destination.
  • Always use lowercase table names.
  • Make php artisan migrate --force a fixed deployment step, as in the Laravel deployment guide.
  • When moving WordPress, move wp-config.php together with its database, or follow the WordPress migration guide.

On ArabyHost

Databases run on MariaDB/MySQL with phpMyAdmin, so you can inspect tables and run the queries above from your browser. AI/Developer plans add SSH for the artisan and grep commands; on other plans, phpMyAdmin covers the database side. Daily JetBackup backups let you restore a whole database if a table is damaged. If you’re not sure which table your site is asking for, the Araby AI assistant reads your error log and explains the cause.

FAQ

Why does the table work on my machine but not on the server?

Usually letter case. On Windows and macOS, MySQL treats Users and users as the same table by default; on Linux they're different. Use lowercase table names in both the database and your code.

I moved a WordPress site and now get this error. Why?

Check $table_prefix in wp-config.php and confirm every table was imported. If the tables start with something other than wp_, put that exact prefix in the file.

What does Table doesn't exist in engine mean?

That's error 1932: MySQL knows the table's name but InnoDB can't find its data, usually because of corruption or files copied incompletely. The safe fix is restoring the database from a backup.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.