Skip to content

Instantly share code, notes, and snippets.

@thiagosf
Created October 25, 2018 15:13
Show Gist options
  • Save thiagosf/2f33f07a7def7c349dd7a2b3cba8a70d to your computer and use it in GitHub Desktop.
Save thiagosf/2f33f07a7def7c349dd7a2b3cba8a70d to your computer and use it in GitHub Desktop.
Backup MySQL and compress it
#!/bin/bash
DATE=`date +%Y-%m-%d`
DATABASE='dbname'
USER='username'
PASS='password'
mysqldump -u $USER -p$PASS $DATABASE > dump-$DATE.sql
zip dump-$DATE.sql.zip dump-$DATE.sql
rm dump-$DATE.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment