Skip to content

Instantly share code, notes, and snippets.

@jimrybarski
Created July 21, 2013 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimrybarski/6048741 to your computer and use it in GitHub Desktop.
Save jimrybarski/6048741 to your computer and use it in GitHub Desktop.
One liner to dump MySQL database and compress on the fly
# standard way
mysqldump my_db -u root -p | gzip -c | cat > my_db.sql.gz
# append a timestamp to the filename
mysqldump my_db -u root -p | gzip -c | cat > my_db-$(date +%Y-%m-%d-%H.%M.%S).sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment