I am trying to export categories and import them back to another Magento database. Therefor I exported every table related to catalog_category_... and imported them into the other database.

Now I am getting this error:

#1005 - Can't create table `magento`.`catalog_category_entity` (errno: 150 "Foreign key constraint is incorrectly formed")

I don't understand this error, because I deleted every catalog_category_ table from the other database, before importing the other dump. Does anyone have an idea?

  • Don't do that. You'll mess up your magento installation. Commented Oct 25, 2017 at 15:56

1 Answer 1


Magento uses InnoDB and foreign keys.

Long story short, this means that when you add a value to one table, there is a "link" that populates values in other tables as well. Same goes for updating and deleting.

So just do not randomly add, delete or update values in your db, or truncate tables that you are absolutely sure that are safe to be truncated.

This is not the correct way to migrate categories from one Magento installation to another, fullstop.

  • ok, i get that. But what u is the correct way to migrate categories then? I tried an extension which does migrate them but with new ids and that´s what i am trying to avoid. I need the catgories to be migrate with the exact same ids. How can i do that the correct way? Would be great if you could give me some tips Greetz Commented Oct 26, 2017 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.