1
SET foreign_key_checks=0;
2
CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
3
CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
4
SET foreign_key_checks=1;
5
SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
8
SET foreign_key_checks=0;