Cannot delete or update a parent row: a foreign key constraint fails(主从表删除解决方案)

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (blockchain.cardtb, CONSTRAINT cardtb_usertb_id_fk FOREIGN KEY (uid) REFERENCES usertb (id))

翻译为

无法删除或更新父行:外键约束失败(blockchain.cardtb,constraintcardtb,usertbu id,fkforeign key(uid)引用usertbid

Cannot delete or update a parent row: a foreign key constraint fails(主从表删除解决方案)

网上查阅了哼多资料,一般的解决方法有两种
一种是 关闭外键约束的检查===》 SET foreign_key_checks = 0;
下面显示Value为OFF,所以关闭了。
Cannot delete or update a parent row: a foreign key constraint fails(主从表删除解决方案)
关闭外键以后进行相关的数据(或者表)删除。
我试了一下,发现还是错误。
所以我又再试了第二种方法
先删除从表,再删除主表

在我的这个数据库里面要删除的数据的这张表 关联了两张从表。所以要把两张从表的相关涉及到的外键删除掉,开始我并没有注意到这一点,一直报错,也没找到错误。

Cannot delete or update a parent row: a foreign key constraint fails(主从表删除解决方案)

Cannot delete or update a parent row: a foreign key constraint fails(主从表删除解决方案)