I’m sure most of you have seen the following error, and in many cases it’s quite easy to diagnose, as the error message is clear:
111111 11:11:11 [ERROR] MySQL is trying to open a table handle but the .ibd file for table test/t does not exist. Have you deleted the .ibd file from the database directory under the MySQL datadir, or have you used DISCARD TABLESPACE? See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html how you can resolve the problem.
From the client side, you may see something like:
ERROR 1146 (42S02): Table 'test.t' doesn't exist
However, if you know you (or some backup/archive script) did not delete the file, nor did you run ALTER TABLE table DISCARD TABLESPACE, then what else could cause this?
Well, I recently found a case where it could occur when a truncate table (on an InnoDB table using the plugin with no foreign keys – so fast truncate method is used, and …
[Read more]