Question

How can I export / import a database correctly?

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

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

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