// MySQL error reference

MySQL error 1051: Unknown table

DROP TABLE (or a similar statement) names a table that doesn't exist in that database.

Error number
1051
Name
ER_BAD_TABLE_ERROR
SQLSTATE
42S02
Category
Databases, tables and columns
Error message
Unknown table '%s'

What it means

1051 is what DROP TABLE reports for a table that isn't there. In a multi-table DROP TABLE a, b, c, the tables that do exist are still dropped and the missing ones are listed.

Common causes

  • Dropping a table twice, or in the wrong database.
  • A typo or letter-case difference on a case-sensitive server.

How to fix it

  1. Use IF EXISTS so a missing table is only a note.

    DROP TABLE IF EXISTS staging_orders;
  2. Check the current database.

    SELECT DATABASE();

Related errors

More databases, tables and columns errors

The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.

// fewer errors, faster fixes

Work on MySQL in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.