A
A
Andrey Shumilin2018-05-20 21:32:55
PHP
Andrey Shumilin, 2018-05-20 21:32:55

How to fix error when importing MySQL database?

when importing database via MySQL console:

SOURCE C:\путь_к_БД\admin_tdekor.sql
following error occurs:
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`ce90120_tdekor`.`#sql-c88_22`,
CONSTRAINT `fk_product_term$product` FOREIGN KEY (`product_id`) REFERENCES `oc_product` (`product_id`) ON DELETE CASCADE ON UPDATE CASCADE)
tried to import it through phpMyAdmin, but since it is quite large in volume, the import is interrupted after a timeout and various errors also occur when re-importing .

wamp server 3.0.4.
MySQl version - 5.7.11,
phpMyAdmin version - 4.8.0.1,
encoding of the database into which I am importing - utf8_general_ci, table type - InnoDB

info about the imported database:
-- phpMyAdmin SQL Dump
-- version 4.7.7
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Server version: 5.7.22-0ubuntu0.16.04.1-log
-- PHP version : 7.2.1-1+ubuntu16.04.1+deb.sury.org+1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2018-05-20
@mr_andersen18

The best way to do a dump is with mysqldump.
If there is already a left dump, then add to the beginning:
and at the end:

/*!40014 SET [email protected]_FOREIGN_KEY_CHECKS */;

T
ThunderCat, 2018-05-20
@ThunderCat

https://github.com/fadlee/bigdump

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question