The thing you want is to fix the corrupt data that is in your current installation. The reason that you are getting Foreign key constraint errors is because the referenced item isn't available. Let's give an example:
You have a product with ID 5. The product is saved in catalog_product_entity
. Now you assign the product to a category, the information for that is saved in catalog_category_product
. In that table there is a column product_id
which has a foreign key to the catalog_product_entity table
So when a line is added to this table the product MUST exist in the catalog_product_entity
table. The advantage is that you protect the database from corruption, is does give you some nasty errors now and then, but at least it wont break your database... in theory.
In your case the database was set up incorrectly, exported with the wrong permissions sometime in the past or something like that, causing the constraint to be probably absent in your case. This causes problems because now you have all sorts of useless rows which just sit there.
Old Advise
The errors you are now getting are probably on the old rows. What I suggest you do is download a database management program which allows you to continue importing when an error occurs ignore the error an continue.
I have not tested not tested this method my self in this specific case, so thorough checking of the imported data is required. If the site is broken after the import then there are probably missing tables in the old database. In that case disable the foreign key check as described in the other comments and run the repair tool you mentioned yourself earlier.
Ps. Since it is about your database and all your data, it may not be unwise to have a magento developer who knows Magento have a look.
New Advise
I'll advise against my own case of importing the data, just had a similar problem today, I ran the following query multiple times (20 times in my case), this removes duplicates from the eav tables and solves a few problems.
DELETE `duplicated`.*
FROM `catalog_product_entity_datetime` AS `orig`
INNER JOIN `catalog_product_entity_datetime` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_product_entity_decimal` AS `orig`
INNER JOIN `catalog_product_entity_decimal` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_product_entity_int` AS `orig`
INNER JOIN `catalog_product_entity_int` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_product_entity_text` AS `orig`
INNER JOIN `catalog_product_entity_text` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_product_entity_varchar` AS `orig`
INNER JOIN `catalog_product_entity_varchar` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_category_entity_datetime` AS `orig`
INNER JOIN `catalog_category_entity_datetime` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_category_entity_decimal` AS `orig`
INNER JOIN `catalog_category_entity_decimal` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_category_entity_int` AS `orig`
INNER JOIN `catalog_category_entity_int` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_category_entity_text` AS `orig`
INNER JOIN `catalog_category_entity_text` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.*
FROM `catalog_category_entity_varchar` AS `orig`
INNER JOIN `catalog_category_entity_varchar` AS `duplicated`
ON (`orig`.`entity_id` = `duplicated`.`entity_id`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`attribute_id` = `duplicated`.`attribute_id`
AND `orig`.`value_id` > `duplicated`.`value_id`);
DELETE `duplicated`.* FROM `core_url_rewrite` AS `orig`
INNER JOIN `core_url_rewrite` AS `duplicated`
ON (
`orig`.`id_path` = `duplicated`.`id_path`
AND `orig`.`is_system` = `duplicated`.`is_system`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`url_rewrite_id` > `duplicated`.`url_rewrite_id`
)
DELETE `duplicated`.* FROM `core_url_rewrite` AS `orig`
INNER JOIN `core_url_rewrite` AS `duplicated`
ON (
`orig`.`request_path` = `duplicated`.`request_path`
AND `orig`.`store_id` = `duplicated`.`store_id`
AND `orig`.`url_rewrite_id` > `duplicated`.`url_rewrite_id`
)
Best Answer
Do you have shell access to the server? If so, you can likely upload the file to it (via FTP or rsync), and then use the MySQL CLI tools to import. Or, if you have remote access to the MySQL server enabled for your IP, you can import directly through your local CLI tool.
Here's an example of what I would do regularly:
MySQL CLI
rsync/SSH/MySQL CLI
The first example requires that you have remote access allowed to your MySQL server, and also the CLI tools installed locally on your machine.
The second example is used when you need to push the database up to the remote server, then you log into it and use the CLI tool there to make the import.
Note that the above command syntax might change depending on your environment, but this is generally the best way to avoid large transfer limits over HTTP.