0

I have exported database. The size of database approximately 10GB. I imported the database in my local server, but Few tables like store & store_group is not installed. I imported store_group but I am not able to import table store. It returns error "Cannot add foreign constraints" every time.

I tried all the possible ways but I am stuck.

Could you please help?

enter image description here

0

I have had the same issue trying to import a clean and fresh install DB of magento2 via phpmyadmin, even if I disable the foreign key checks when exporting the db.

I would recommend to import the database via the console, especially if it is large (I would say 10GB is rather large).

mysql -h YOUR_DB_HOST -u DB_USER -pDB_PASS DB_TABLE_TO_IMPORT_TO < MY_DATABASE_DUMP.sql

Obviously replace the caps words with your own info. There is no space between -p and your password.

I would also recommend to create the mysql dump via the console:

mysqldump -h YOUR_DB_HOST -u DB_USER -pDB_PASS DB_TABLE_TO_EXPORT > MY_DATABASE_DUMPFILE.sql

  • Thank you @tecjam. I imported database by console using source db.sql command but Unfortunately store related tables are not imported. :( – Sameer Bhayani Jun 6 '18 at 12:58
  • How did you create the db dump? Via phpmyadmin? Try dumping by console, also. I'll add the command to my code above. – tecjam Jun 6 '18 at 12:59
  • I create db via following command: mysqldump -u user -p db | gzip > date -I.database.sql.gz – Sameer Bhayani Jun 6 '18 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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