How to import and export Magento 2 database?

How to import and export Magento 2 database? Without getting errors like “A foreign key constraint fails” or “Access denied; you need (at least one of) the SUPER privilege(s) for this operation”

All you need to do is to export and import in ssh command line

First make export file from database where is data:

mysqldump -h hostname -u username -ppassword database > mydumpfile.sql
Code language: C# (cs)

And then import in database where you want to get data

mysql -h hostname -u username -ppassword database < mydumpfile.sql
Code language: C# (cs)

Leave a comment

Your email address will not be published. Required fields are marked *