How can I export / import a database correctly?

October 30, 2019 141 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?

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!

Have another answer? Share your knowledge.