How can I export / import a database correctly?

Posted October 30, 2019 6.1k views

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?

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.

Submit an Answer
1 answer


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!