Skip to content

Instantly share code, notes, and snippets.

@suxiaogang
Last active January 28, 2016 02:49
Show Gist options
  • Select an option

  • Save suxiaogang/a6ed82128534ca5751f8 to your computer and use it in GitHub Desktop.

Select an option

Save suxiaogang/a6ed82128534ca5751f8 to your computer and use it in GitHub Desktop.
#!/bin/sh
#================================================
# backup mysql
#================================================
# set up all the mysqldump options
FILE=backup_`date +"%Y%m%d_%H_%M"`_structure.sql
DATABASE=DBNAME
USER=root
PASS=root
# set up mysqldump
mysqldump --user=${USER} --password=${PASS} -d --database ${DATABASE} > /mysql_bak/${FILE}
echo "Successfully ~;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment