Fixing the MySQL ‘1146 Table Doesn’t Exist’ Error in Your Server

Fixing the MySQL ‘1146 Table Doesn’t Exist’ Error in Your Server

The 1146 Table Doesn’t Exist is a common error faced by MySQL server admins. While there are multiple reasons behind this error, fixing it is actually easy. In this article, we explain those reasons and provide solution to fix the issue.

Why the 1146 Table Doesn’t Exist Error Occurs?

As already mentioned, there are multiple reasons behind this issue. When you come across it, you’ll get the following error message:

Code:
Error : Table ‘mysql.innodb_index_stats’ doesn’t exist
status : Operation failed
You get this error because of the following reasons:

The InnoDB has crashed

InnoDB crashing is one of the main reasons why you have corrupt tables. InnoDB can crash if the server didn’t restart as intended or there was any type of process load. User abuse is another reasons behind the InnoDB crashing.

ibdata file is missing in MySQL datadir

The InnoDB utilizes data directory to function properly. The directory consists of ibdata file, log files, among other things. If those things aren’t available on the datadir, you’re going to face this issue. Migration, upgrades, or restoration are some events during which the ibdata file goes missing.

.frm files are placed at wrong places

InnoDB uses the .frm files to define the format of the tables. If this file is not available in the right places, InnoDB will fail to determine the table format, thus leading to the issue.

MySQL datadir has incorrect permission and ownership

Just like InnoDB, MySQL has a data directory too. It located at ‘/var/lib/mysql’ and store the database files. In case the permissions and ownership of the directory are not set appropriately, you’re going to face this error.

The tables are corrupted

There are many other ways in which the tables of an MySQL database can get corrupted. If that’s the case, you’ll come across this error message.

How to Fix this Issue?

Just like there are multiple reasons behind this issue, there are multiple ways you can fix it. Try the following solutions one by one:

Restart the MySQL Server

At times, something as simple as restarting the server can solve this issue. If the server didn’t restart properly, then restarting it once again will most likely fix the issue. If the problem persists, the continue on to the next recommended solutions.

Repair the tables

If you repair the tables, the corrupted tables will get repaired as well, thus solving the issue. Use the ‘myisamchk’ tool that comes with MySQL to repair the table.

Restore the latest backup

Restoring the latest backup (the one that was created just before the error emerged) can fix the issue. If that version is working, it must have tables that aren’t corrupt. It’s recommended that you take backups regularly, or at least once a week. This would help you restore the correct version in case you fix issues like this.

Copy the ibdata file from backup

If your ibdata file is missing, you can restore that from the backup file. It should fix the issue at hand. Restore the file to the data directory after you discard the tablespace. It’d avoid any kind of corruption.

InnoDB crash recovery

You can conduct an InnoDB crash recovery if none of the aforementioned solutions work.

So that’s how you fix the MySQL ‘1146 Table Doesn’t Exist’ error. For more assistance, contact the hosting support team.
Author
kumkumsharma
Views
11,830
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top