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
Call Stack
#TimeMemoryFunctionLocation
10.0019412344{main}( ).../index.php:0
20.08374262360Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.08374262360Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.295711453280Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.296311477656Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.297011532984Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.297211560384require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.305911960016K2ControllerItem->execute( ).../k2.php:64
90.305911960016K2ControllerItem->display( ).../BaseController.php:710
100.316112610720K2ControllerItem->display( ).../item.php:78
110.316112610720K2ControllerItem->display( ).../controller.php:19
120.320712981760Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.324313002128K2ViewItem->display( ).../ViewController.php:102
140.429315802760K2ViewItem->display( ).../view.html.php:742
150.429315802760K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.432715975696include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
  • Published in MYSQL
  • Read 1208 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
Call Stack
#TimeMemoryFunctionLocation
10.0019412344{main}( ).../index.php:0
20.08374262360Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.08374262360Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.295711453280Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.296311477656Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.297011532984Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.297211560384require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.305911960016K2ControllerItem->execute( ).../k2.php:64
90.305911960016K2ControllerItem->display( ).../BaseController.php:710
100.316112610720K2ControllerItem->display( ).../item.php:78
110.316112610720K2ControllerItem->display( ).../controller.php:19
120.320712981760Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.324313002128K2ViewItem->display( ).../ViewController.php:102
140.429315802760K2ViewItem->display( ).../view.html.php:742
150.429315802760K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.432715975696include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
back to top