问题
Environment:
Windows 7 (XAMPP latest) Apache 2.4.4 PHP 5.5 MySQL 5.6.11
I am trying to backup a database from MySQL 5.1 and import it to MySQL 5.6.
In MySQL 5.1, there are some MyISAM and InnoDB tables. I use mysqldump to dump the SQL file out, with --add-drop-database switch.
Now when I go back to my localhost and import the SQL file using MySQL workbench, an error occur:
InnoDB: cannot calculate statistics for table "database"."tables" because the .ibd file is missing.
I tried drop the database using:
drop schema database
And it crashes the MySQL 5.6, with error like this:
2013-09-10 17:18:23 fc4 InnoDB: Warning: MySQL is trying to drop database `database`.``
InnoDB: though there are still open handles to table `database`.`table`.
In my.ini I set:
innodb_force_recovery = 4
I tried:
- Create a new database with different database name and run the import again, all innodb tables cannot be created.
- Copy all *.frm tables from a working 5.1 server in data directory, overwrite existing database, restart MySQL 5.6.11, all innodb tables cannot be accessed.
- If I run a create table statement with engine=InnoDB, it will failed and said table already exists, which actually it does not exists.
- If I run a drop table statement that using InnoDB, it will say table does not exists...
Can anyone please give me some advices on it?
Thank you.
回答1:
It turns out that it seems to be a MySQL 5.6.11 problem, I change MySQL to 5.5.30 and it all works well.
回答2:
I had a similar problem on Mac OS X, but in a slightly bizarre way: I was running fine on some pre-5.6.19 version and then upgraded to 5.6.19, which started to give me the error message above, except none of my tables use mixed case.
As it turned out, one of my databases is using an uppercase character as its first letter. This has worked fine for a long time, but failed this morning after the minor version upgrade and sent me into a 2-hour search for what went wrong.
The fix is simple: create a symlink with the lower case version, restart mysqld and all is well. However, even though I understand the logic for making tables case-safe, there is no danger of the database name being ambiguous since the OS would always prevent that.
来源:https://stackoverflow.com/questions/18717042/mysql-innodb-cannot-calculate-statistics-because-the-ibd-file-is-missing