Skip to content

Instantly share code, notes, and snippets.

@tony4d
Last active June 18, 2018 09:52
Show Gist options
  • Save tony4d/5997845 to your computer and use it in GitHub Desktop.
Save tony4d/5997845 to your computer and use it in GitHub Desktop.
Using mysqldump for backups on a slave. Note the use of --master-data=2, this makes sure we get a global read lock and write out a comment in the sql file with the master log filename and current position. Now this backup is good for adding or bringing back a slave from scratch.
mysqldump -u [user] -p -xQce -R --master-data=2 --max-allowed-packet=1024M -B [db_name] | gzip > [db_name].sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment