Bug #107311 InnoDB: Load table xx failed; Table xx doesn't exist
Submitted: 17 May 2022 2:50 Modified: 17 May 2022 7:12
Reporter: zhijun long Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.7.38 OS:Any
Assigned to: CPU Architecture:Any

[17 May 2022 2:50] zhijun long
Description:
The character set of the foreign key field is different, causing the table to be lost after restart.

error.log
2022-05-17T01:55:49.704838Z 2 [Warning] InnoDB: Load table `test`.`t2` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.
2022-05-17T01:55:49.711208Z 2 [Warning] InnoDB: Load table `test`.`t2` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.

How to repeat:
MTR test

create table t1(id varchar(50) not null primary key, c1 int) DEFAULT CHARSET=utf8mb4;
create table t2(id int, c1 varchar(50), KEY `idx1` (`c1`), CONSTRAINT fk_idx1 FOREIGN KEY (`c1`) REFERENCES `t1` (`id`))DEFAULT CHARSET=utf8mb4;
set foreign_key_checks=off;
alter table t1 modify `id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;

--echo "Restarting MySQL server"
--source include/restart_mysqld.inc
--echo "MySQL restarted"

select * from test.t1;

Result:
mysqltest: At line 11: query 'select * from test.t2' failed: 1146: Table 'test.t2' doesn't exist
[17 May 2022 7:12] MySQL Verification Team
Hello zhijun long,

Thank you for the report and test case.

regards,
Umesh