How to Fix MySQL 1146 Error Table Doesn’t Exist

“An e-commerce company decided to upgrade its MySQL server from version 5.7 to the current version. They took the step to leverage new JSON indexing and improve the performance. Next, what they did was to export all databases using mysqldump and import them on the new server. This resulted in the MySQL 1146 table doesn’t exist error. Even though the file was physically present, it was inaccessible. They asked to provide reliable solutions for error fixing.”

Did you also receive the MySQL table doesn’t exist message on the screen? This error generally refers that you know a table exists, but the error says no table exists in the default database. In this guide, we’ll learn the ultimate ways to resolve the error for free and understand why it happens. Also, study the MySQL Database Recovery Tool to perform a quick fix for table retrieval efficiently.

Download Buy Now

MySQL Table Doesn’t Exist, But Why?

The error 1146 MySQL table doesn’t exist arises in the following situations:

  • When you run a query on a deleted, renamed, or uncreated table.
  • The .frm and .ibd files are corrupted or go missing.
  • A mismatch prevails between the actual table name and the one in the code references.
  • The SQL data dictionary has gone out of sync.
  • Accidental table deletion or file permission restrictions.

There are many more similar factors due to which the error may arise. But they can all be fixed with some simple workarounds.

Below, you’ll find a detailed instructional guide on how to resolve the error in a manual and professional way.

Native Fix MySQL 1146 Table Doesn’t Exist

There are various steps involved to completely resolve the error for free. These are:

  1. First, verify the table name and syntax before proceeding further.
  2. Next, use the path [/var/lib/mysql/your_db/] and verify if the table exists.
  3. Further, if the table is lost and you remember the structure, create a new one by using the query:
  4. CREATE TABLE tb_name ( id INT PRIMARY KEY, name VARCHAR(100) );
  5. If this doesn’t help, use the backup query to restore the table:
    mysql -u root -p your_db < backup.sql
  6. Afterward, if the table doesn’t exist in engine MySQL, then follow these steps:
    • Create a new table with the original structure as before.
    • Then, run ALTER TABLE tb_name DISCARD TABLESPACE;
    • Now, replace the original file with the new .ibd file.
    • Finally, execute the ALTER TABLE tb_name IMPORT TABLESPACE; query.
  7. Note: This only works if the .ibd file exists and the table was created with the InnoDB engine.

  8. Later, one more thing that you can try is to check the permissions if the table doesn’t exist. To verify, run the query:
    SHOW GRANTS FOR ‘username’@’host’;

However, if the manual solutions fail to fix the error, or you have crucial data stuck in the table. Then, try the expert approach for safe recovery.

Automatically Fix MySQL 1146 Table Doesn’t Exist

Whether your file is corrupted, lost, or accidentally deleted, use the MySQL Database Recovery Tool and fix the issues. It scans the unhealthy .ibd and .frm files and supports their complete recovery. Additionally, the tool doesn’t require MySQL and supports both InnoDB and MyISAM tables. Moreover, it is easy to use and runs on all Windows system versions without any issues. You can seamlessly recover corrupt MySQL database with 100% accuracy and fast processing.

Fix Table ‘tbl_name’ doesn’t exist with these steps:

  1. Run the MySQL Database Repair and add your files with Open.
  2. Click OK and check all the database objects by choosing from the tree.
  3. Then, add your ibData1 file into the tool for complete display.
  4. Further, pick folders and press on Save MySQL data.
  5. At last, specify a target path to save and check the connection. Hit OK to recover.

Comparison: Manual vs Professional

Though we have different ways to fix MySQL 1146 Table Doesn’t Exist issue, which one is exactly the best? To find the same, refer to the table below:

FeaturesManual MethodExpert Tool
UsabilityRequires in-depth MySQL and technical knowledgeSimple and user-friendly GUI
Time-consumingMuch with many tablesQuick and automatic
Data LossHigh riskNo risk
RecoveryPartial and difficult for specific tablesComplete and allows selective recovery

Thus, whenever you encounter error 1146: table doesn’t exist in engine MySQL. Try to take a table backup and recovery first with the professional tool.

Conclusion

The MySQL 1146 Table Doesn’t Exist isn’t just a missing table error; it also represents that the table is out of sync, has schema flaws, storage problems, and more. It can be difficult and frustrating at times with large and complex databases, but the right solutions help resolve them all. Opt for any of the manual or professional ways after a clear understanding of all, and eliminate the error to access the database.

Frequently Asked Questions

Q. How to confirm the table physically exists in MySQL’s data directory?

Ans- If you have encountered the Table ‘tbl_name’ doesn’t exist error and you know that the table exists. Then, do the following:
1. First, check the directory path, i.e., /var/lib/MySQL/mysqldbname/
2. Next, find the tb_name.frm, tb_name.ibd, or tb_name.MYD files.
3. Ensure they aren’t missing or corrupted. It helps identify the error and verifies the existence.

Q. Are there any tools to auto-scan the database for missing MySQL files?

Ans- Yes. With the MySQL Recovery Tool, scan, identify, and restore the .idb and .frm MySQL files. It will also help fix the MySQL 1146 error.

Rate this post

About The Author:

Suman Rawat is a technical content writer and expert in the fields of email migration, data recovery, and email backup. Her passion for helping people has led her to resolve many user queries related to data conversion and cloud backup.

Related Post