Language/NoSQL&JDBC

[mysql] Error Code: 1451. Cannot delete or update a parent row: a foreign key

아르비스 2016. 3. 14. 12:40

Error Code: 1451. Cannot delete or update a parent row: a foreign key constraint fails


와 같은 error로  mysql에서 DB delete와 update가 안될 때, 처리방법

SET FOREIGN_KEY_CHECKS=0; -- to disable them
SET FOREIGN_KEY_CHECKS=1; -- to re-enable them


foreign key를 처리해주면 좋지만, 안될경우, check만 skip 후 다시 설정