How to fix ERROR 1109: Unknown table in MySQL

MySQLINTERMEDIATEHIGHUpdated Dec 23, 2025· 177 views

ERROR 1109 occurs when MySQL cannot find a referenced table in your query. This is usually due to typos, incorrect database context, or table aliases. Fix it by verifying table names, checking your database context, and confirming the table exists.

Quick fix

Fixes ERROR 1109: Unknown table

SELECT DATABASE();
  1. Verify your current database context
  2. Check that the table exists
  3. Fix table name typos
  4. Use the correct table or alias name in your query
mysql — error
SELECT DATABASE();
ERROR 1109: Unknown table

What this error means

ERROR 1109 (ER_UNKNOWN_TABLE with SQLSTATE 42S02) is thrown when MySQL cannot locate the specified table in the context where you're trying to use it. The error message format is "Unknown table '%s' in %s", where the first placeholder is the table name and the second is the clause where the error occurred (FROM, JOIN, DELETE, UPDATE, etc.). This error indicates a mismatch between what you're asking MySQL to find and what actually exists in the database or is currently accessible in your session.

Typical symptoms

  • Queries fail with "Unknown table" error messages
  • Working queries suddenly fail after schema changes or migrations
  • Error occurs with HANDLER statements or complex JOIN queries
  • Mysqldump fails with "Unknown table 'COLUMN_STATISTICS' in information_schema"
  • Different behavior when querying from different database contexts

Common causes

  1. Table name contains a typo or incorrect spelling in the query
  2. You are connected to the wrong database and the table does not exist in the current database context
  3. The table was dropped, renamed, or not yet created
  4. You referenced the base table name after assigning an alias to it
  5. Using a table from a different database without the schema prefix (database.table)
  6. Temporary table was created in a previous session and no longer exists
  7. HANDLER statement referencing a table that hasn't been opened yet
  8. Version mismatch: mysqldump 8+ trying to export COLUMN_STATISTICS from MySQL <8.0

How to fix "ERROR 1109: Unknown table"

1Verify your current database context

First, confirm you are connected to the correct database by running:

sql
SELECT DATABASE();

If the output is NULL or shows the wrong database, switch to the correct one:

sql
USE your_database_name;

Ensure the database name in your connection string or client configuration matches where your table actually exists.

2Check that the table exists

Verify the table is present in your database:

sql
SHOW TABLES LIKE 'your_table_name';

You can also list all tables in the database:

sql
SHOW TABLES;

If the table doesn't appear, it either doesn't exist, was dropped, or is in a different database. Create it if necessary or adjust your query to point to the correct table.

3Fix table name typos

Review your query carefully for spelling mistakes. MySQL table names are case-sensitive on Linux/Unix systems but case-insensitive on Windows/macOS. Common mistakes include:

sql
-- WRONG: typo in table name
SELECT * FROM userss WHERE id = 1;

-- CORRECT: correct spelling
SELECT * FROM users WHERE id = 1;

If you're unsure of the exact table name, use SHOW TABLES to find the correct spelling.

4Use the correct table or alias name in your query

If you assigned an alias to a table, you must use the alias when referencing columns from that table, not the original table name:

sql
-- WRONG: using original table name after alias assignment
SELECT products.id FROM products AS p WHERE p.price > 100;

-- CORRECT: use the alias consistently
SELECT p.id FROM products AS p WHERE p.price > 100;

Also, when using HANDLER statements, open the table before trying to read from it:

sql
HANDLER products OPEN;
HANDLER products READ FIRST;
HANDLER products CLOSE;
5Use fully qualified table names in shared environments

When working with multiple databases or in shared environments, explicitly specify the database name:

sql
-- WRONG: ambiguous in shared environments
SELECT * FROM my_table;

-- CORRECT: fully qualified
SELECT * FROM database_name.my_table;

This prevents errors when the same table exists in multiple databases or when the connection defaults to the wrong database.

6Fix mysqldump version mismatch errors

If you're getting "Unknown table 'COLUMN_STATISTICS' in information_schema" when using mysqldump 8+ to export from MySQL <8.0, add the --column-statistics=0 flag:

bash
mysqldump --column-statistics=0 -u root -p database_name > backup.sql

The COLUMN_STATISTICS table was introduced in MySQL 8.0, so mysqldump 8+ tries to export it by default. This flag disables that behavior for compatibility with older MySQL versions.

Advanced notes

Replication lag can cause "Unknown table" errors on replicas: DDL operations may not have been applied yet if the replica is behind the primary. Wait for the relay log to catch up or resynchronize the replica. Temporary tables (prefixed with # in some databases) are session-specific and disappear when the connection closes—they cannot be accessed by other connections. When diagnosing Error 1109, check your query logs and client configuration to ensure statements are reaching the correct database instance. On case-sensitive systems (Linux), MySQL table names follow the filesystem case sensitivity rules, while on case-insensitive systems (Windows/macOS), MySQL treats them case-insensitively by default.

Frequently asked questions

What does "ERROR 1109: Unknown table" mean?
ERROR 1109 (ER_UNKNOWN_TABLE with SQLSTATE 42S02) is thrown when MySQL cannot locate the specified table in the context where you're trying to use it. ). This error indicates a mismatch between what you're asking MySQL to find and what actually exists in the database or is currently accessible in your session.
How do I fix "ERROR 1109: Unknown table"?
ERROR 1109 occurs when MySQL cannot find a referenced table in your query. This is usually due to typos, incorrect database context, or table aliases. Fix it by verifying table names, checking your database context, and confirming the table exists.
What causes "ERROR 1109: Unknown table"?
Table name contains a typo or incorrect spelling in the query You are connected to the wrong database and the table does not exist in the current database context The table was dropped, renamed, or not yet created
Is the "ERROR 1109: Unknown table" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading