Guest User

Untitled

a guest
Jan 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. USER="abc"
  4. PASSWORD=""
  5.  
  6. ExcludeDatabases="Database|information_schema|performance_schema|mysql"
  7. databases=`mysql -u $USER -p$PASWORD -e "SHOW DATABASES;" | tr -d "| " | egrep -v $ExcludeDatabases`
  8.  
  9. for db in $databases; do
  10.  
  11. echo "Dumping database: $db"
  12. mysqldump -u $USER -p$PASSWORD --databases $db > `date +%Y%m%d`.$db.sql
  13.  
  14. done
  15.  
  16. #run this code in command line: /bin/sh all_db_backup.sh
  17. #make sure you are in the directory in which you want to store the files, before running the script
Add Comment
Please, Sign In to add comment