Skip to content

Instantly share code, notes, and snippets.

@mallamanis
Created June 7, 2011 21:50
Show Gist options
  • Save mallamanis/1013258 to your computer and use it in GitHub Desktop.
Save mallamanis/1013258 to your computer and use it in GitHub Desktop.
Simple MySQL Dump backup
#!/bin/bash
mysqldump --all-databases --user="username" --password="password" --single-transaction >/destination/folder/all_databases.sql
cd /destination/folder/
# Create new archive
ARCHIVE_NAME=DBs$(date '+%G%m%d%k').tar
tar -cvvf $ARCHIVE_NAME all_databases.sql
#delete file
rm all_databases.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment