Disabling foreign key check using following SQL: SET FOREIGN_KEY_CHECKS=0; Enabling foreign key check: SET FOREIGN_KEY_CHECKS=1; If you want it globally then: SET GLOBAL FOREIGN_KEY_CHECKS=0; SET GLOBAL FOREIGN_KEY_CHECKS=1;