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。

原文:https://tlingc.com/2019/08/solving-mysql-table-doesnt-exist-in-engine/

你可能感兴趣的:(MySQL Table doesn't exist in engine 解决方法)