Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- USER=root
- PASS=
- DBNAME=mydb
- DIRLOCAL=/home/user/dumps/
- cd $DIRLOCAL
- mkdir `date +%Y%m%d`
- cd `date +%Y%m%d`
- for table in `echo "show tables" | mysql -u $USER -p$PASS $DBNAME | grep -v ^mysql$ | grep -v ^Tables_in_$BBDD$`;
- do
- #one file per table
- mysqldump --add-drop-table --routines -u $USER -p$PASS $DBNAME ${table}> ${table}.sql;
- done
- gzip *
Add Comment
Please, Sign In to add comment