mysql ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constrain fails

ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constrain fails。

It may be that MySQL has set a foreign key association in InnoDB, making it impossible to update or delete data. This can be avoided by setting the FOREIGN_KEY_CHECKS variable.

1、set foreign_key_checks=0;

2. Delete the table to be deleted;

3、set foreign_key_checks=1;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324660453&siteId=291194637