MySQL DB Importation error w.r.t. Foreign Key Constraints failure

Category: MySQL

When importing a MySQL DB in N99panel, via MySQL DB import functionality ( https://n99panel.com/ufaq/how-can-i-import-a-very-large-mysql-db-or-a-sql-file-into-a-n99panel-vps/ ) , and if you see any error under N99panel tasks pertaining to ‘Cannot add or update a child row: a foreign key constraint fails’ or any similar errors w.r.t. foreign key constraints failure, please do the following action.

Plase the following line

SET SESSION FOREIGN_KEY_CHECKS=0;

as the very first line in your SQL File , and try re-importing again. This should solve the issue.

 

Leave a Reply