Advertisement
Guest User

Untitled

a guest
Sep 21st, 2012
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ "$1" == "" ]; then
  4. echo "Usage: $0 [output-path]"
  5. exit 1
  6. fi
  7.  
  8. TABLES=`mysql -B -N -e "select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='$1'"`
  9.  
  10. OUT="$2"
  11. if [ "$OUT" == "" ]; then
  12. OUT="."
  13. fi
  14. if [ ! -d $OUT ]; then
  15. echo "$OUT does not exist"
  16. exit 1
  17. fi
  18.  
  19. for table in $TABLES; do
  20. echo -n "dumping $1.$table..."
  21. mysqldump $1 $table > $OUT/$1.$table.sql
  22. echo "done"
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement