Created
August 21, 2015 18:17
-
-
Save vijinho/6039c345a46feb8a278c to your computer and use it in GitHub Desktop.
dump mysql database schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MYSQLDUMP=`which mysqldump` | |
DB="mysql" | |
HOST="127.0.0.1" | |
USER="root" | |
PASS="root" | |
# backup file settings | |
BACKUPDIR="${HOME}/backup/mysql" | |
mkdir -p $BACKUPDIR | |
DATE=`date "+%Y%-m%-d-%H%M"` | |
FILE="$BACKUPDIR/$DB-$DATE.sql" | |
OPTS="--verbose --force --quick --compress --comments --triggers --routines --dump-date --skip-add-drop-table --extended-insert --delayed-insert --order-by-primary" | |
# dump schema | |
$MYSQLDUMP --host=$HOST --user=$USER --password=$PASS --no-data $OPTS $DB > $FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment