Pages

Tuesday, April 17, 2012

MySQL dump to .gz file in 1 line

Came across this neat little 1-line linux script to dump a mysql database to an zipped sql file.  Auto-named based on current date/time too!

mysqldump -u <username> -p<password> <database> | gzip -c > <database>_$(date +%Y%m%d_%H%M%S).sql.gz

I love snippets that speed up things I do dozens of times a day sometimes!

No comments:

Post a Comment