Skip to content

Instantly share code, notes, and snippets.

@nopium
Created April 8, 2014 09:17
Show Gist options
  • Save nopium/10103727 to your computer and use it in GitHub Desktop.
Save nopium/10103727 to your computer and use it in GitHub Desktop.
#!/bin/sh
DB=YOUR_DB_NAME
USER=DB_USER
PASSWORD=DB_PASS
BACKUP_DIR=~/db_backups/$DB
[ -d "$BACKUP_DIR" ] || mkdir -p "$BACKUP_DIR"
mysqldump -u$USER -p"$PASSWORD" $DB | gzip -c > $BACKUP_DIR/`date +"%Y-%m-%d_%H%M"`.sql.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment