How can I export / import a database correctly?

  • Posted October 30, 2019
  • MySQL

We use a database cluster. When I export the database I run the following command:

mysqldump --single-transaction --quick -u[user] -p[password] -h[host] -P[port number] [database] > [path]

I use homestead to work locally, and to import the database I execute this command:

mysql -uhomestead -psecret -D [database] < [file.sql]

But I receive an error message:

ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

This is the first time I have this error. What does it mean? What is the correct way to export / import?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


What you could try is to open the .sql dump file and remove the GLOBAL statement from line 24. Then try the import again.

Hope that this helps! Regards, Bobby