Guest User

Untitled

a guest
Jan 27th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #!/bin/bash
  2. USER=root
  3. PASS=
  4. DBNAME=mydb
  5. DIRLOCAL=/home/user/dumps/
  6.  
  7.  
  8. cd $DIRLOCAL
  9. mkdir `date +%Y%m%d`
  10. cd `date +%Y%m%d`
  11. for table in `echo "show tables" | mysql -u $USER -p$PASS $DBNAME | grep -v ^mysql$ | grep -v ^Tables_in_$BBDD$`;
  12. do
  13. #one file per table
  14. mysqldump --add-drop-table --routines -u $USER -p$PASS $DBNAME ${table}> ${table}.sql;
  15.  
  16. done
  17. gzip *
Add Comment
Please, Sign In to add comment