Skip to content

Instantly share code, notes, and snippets.

@IcyApril
Last active August 29, 2015 14:15
Show Gist options
  • Save IcyApril/45b5d8996103b31b7281 to your computer and use it in GitHub Desktop.
Save IcyApril/45b5d8996103b31b7281 to your computer and use it in GitHub Desktop.
# Backup MySQL datbases.
# Change -uroot to -u{username} and -ppassword to -p{password}.
# Or remove -ppassword if you don't have one.
# If you're running this as a cron, remove the .sh extension before putting it in /etc/cron.daily.
# DIRBASE is the folder where the database backups will be stored, they will be stored by day of the month.
#!/bin/bash
DATED=`date +%d`
DIRBASE="/var/www/work/mysqlbackups"
mysqldump -uroot -ppassword --all-databases > ${DIRBASE}/${DATED}.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment