Skip to content

Instantly share code, notes, and snippets.

@jkischkel
Created February 12, 2015 14:34
Show Gist options
  • Save jkischkel/d9c45dfbd22bbe43d58a to your computer and use it in GitHub Desktop.
Save jkischkel/d9c45dfbd22bbe43d58a to your computer and use it in GitHub Desktop.
mysqldump
# create uncompressed dump
mysqldump -u root --databases soundcloud_test > dump.sql
mysql -u root < dump.sql
# create compressed dump
mysqldump -u root --databases soundcloud_test | gzip > dump.sql.gz
gunzip < dump.sql.gz | mysql -u root
# create csv files
## with column names
mysql -B -u root -D soundcloud_test -e "select * from app_tags" | tee table.csv
## without column names
mysql -B --skip-column-names -u root -D soundcloud_test -e "select * from app_tags" | tee table.csv
# setup cron job
crontab -e
*/1 * * * * /usr/local/bin/mysqldump -u root --databases soundcloud_test > /Users/jankischkel/tmp/dump.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment