i want to import old customer data to new magento store i have imported all customer's table instead of customer_entity, when i import this table i am getting this error

1005 - Can't create table test.customer_entity (errno: 150 "Foreign key constraint is incorrectly formed")

Please help me out for this issue.

1 Answer 1


This error could be due to several reasons but you are working with imported tables so try checking ENGINE and/or CHARSET parameters: It can happen you are trying to add a new table using a different one!

From: MySql - Using FOREIGN KEY Constraints

If you re-create a table that was dropped, it must have a definition that conforms to the foreign key constraints referencing it.

So if you are using a .sql file to import the customer's tables, open it and check it: at the end of queries there should be something like:


then be sure to use those same parameters for the new customer_entity table.

If the problem keep showing, check if foreign key column and the referencing have same column type or length, read more here.

Reed also here MariaDB: InnoDB foreign key constraint errors

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.