导入数据库出现下面提示错误:
ERROR 1005 (HY000) at line 1727: Can't create table 'xxxxxxx' (errno: -1)
查看日志会有以下报错:
120912 20:24:42 InnoDB: Error creating file './xxxxxx.ibd'.
120912 20:24:42 InnoDB: Operating system error number 17 in a file operation.
InnoDB: Error number 17 means 'File exists'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: The file already exists though the corresponding table did not
InnoDB: exist in the InnoDB data dictionary. Have you moved InnoDB
InnoDB: .ibd files around without using the SQL commands
InnoDB: DISCARD TABLESPACE and IMPORT TABLESPACE, or did
InnoDB: mysqld crash in the middle of CREATE TABLE? You can
InnoDB: resolve the problem by removing the file './xxxxxxxxx.ibd'
InnoDB: under the 'datadir' of MySQL
?
从报错日志可以看到解决方法:
InnoDB: resolve the problem by removing the file './xxxxxxx.ibd'
所以只要移除'./xxxxxxxx.ibd'这个文件即可