For me just SET FOREIGN_KEY_CHECKS=0;
wasn't enough.
I was still having a com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException
.
I had to add ALTER TABLE myTable DISABLE KEYS;
.
So:
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE myTable DISABLE KEYS;
DELETE FROM myTable;
ALTER TABLE myTable ENABLE KEYS;
SET FOREIGN_KEY_CHECKS=1;