How to import mysql innodb with foreign key constraint error?

To import mysql innodb with foreign key constraint error, follow the steps below:-

  • If you have the access to mysql thru terminal, then you can use the command below:-
    mysql> SET foreign_key_checks = 0;
    mysql> SOURCE your_db_dump_file;
    mysql> SET foreign_key_checks = 1;
    
  • If you import your database thru web interface like phpmyadmin, then you need to edit the sql dump file. Add this to the 1st line of your sql db dump file:-
    SET foreign_key_checks = 0;
  • then add this line to the last line in your sql db dump file:-
    SET foreign_key_checks = 1;
  • Now you may import your sql dump file, and it should have no error by now.

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
  • Published in MYSQL
  • Read 1251 times

Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
back to top