DevsDawn
DevsDawn

MySQL Table doesn't exist in engine 解决方法

数据表设置了外键,在phpMyAdmin中显示该表使用中,点击访问表时提示Table doesn’t exist in engine。
mysql日志显示:

2019-08-24 14:32:25 616 [Warning] InnoDB: Load table ‘xxx’ failed, the table has missing foreign key indexes. Turn off ‘foreign_key_checks’ and try again.
2019-08-24 14:32:25 616 [Warning] InnoDB: Cannot open table xxx from the internal data dictionary of InnoDB though the .frm file for the table exists. See http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html for how you can resolve the problem.

判断为外键出错所致,执行下述SQL语句关闭外键检查即可进入该表:

SET FOREIGN_KEY_CHECKS = 0;
//或者
SET GLOBAL FOREIGN_KEY_CHECKS = 0;

重新调整外键,并把外键检查重新开启即可。

SET FOREIGN_KEY_CHECK = 1;
//或者
SET GLOBAL FOREIGN_KEY_CHECKS = 1;

另外有时候删除与出问题的表没有关联的数据库时,好像也有几率出现此问题,通过上述关闭、打开外键检查就可以恢复,而无需调整任何外键的设置,可能是InnoDB的bug。

若无特别说明,本文采用 CC BY-SA 4.0 协议进行许可。如需转载,请附上本文链接和本声明。
本文链接:https://devsdawn.com/2019/08/solving-mysql-table-doesnt-exist-in-engine/
DigitalOcean云服务,美国上市公司,注册即送200USD体验金
Vultr云服务,全球25+地域,注册即送100USD体验金

发表回复

textsms
account_circle
email

DevsDawn

MySQL Table doesn't exist in engine 解决方法
数据表设置了外键,在phpMyAdmin中显示该表使用中,点击访问表时提示Table doesn't exist in engine。 mysql日志显示: 2019-08-24 14:32:25 616 [Warning] InnoDB: Load table 'xxx'…
扫描二维码继续阅读
2019-08-24