Skip to content

Instantly share code, notes, and snippets.

@ethaizone
Created May 12, 2018 07:05
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 ethaizone/feff6f5290e58afba78cc51dc546c67e to your computer and use it in GitHub Desktop.
Save ethaizone/feff6f5290e58afba78cc51dc546c67e to your computer and use it in GitHub Desktop.
MySQL - Dump and import with GZip
# Export
mysqldump -u root -p your_db | gzip -c > your_db_2018-05-12.sql.gz
# Export with datetime in filename
mysqldump -u root -p your_db | gzip -c > your_db_$(date +%Y-%m-%d-%H.%M.%S).sql.gz
# Import
zcat your_db_2018-05-12.sql.gz | mysql -u root -p your_db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment