Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. #! /bin/bash
  2. USER="user"
  3. PASS="password"
  4. DB="database";
  5.  
  6. FIRST_LINE=1
  7. for x in $(mysql -u $USER --password=$PASS --execute='SHOW TABLES' $DB); do
  8.     # skip the first line which is 'Tables_in_$DB'
  9.     if [ $FIRST_LINE -eq 1 ]; then
  10.         FIRST_LINE=0
  11.         continue
  12.     fi
  13.  
  14.     mysqldump --add-drop-table --add-locks --comments --disable-keys --dump-date --extended-insert --no-create-db --order-by-primary --quote-names -u $USER --password=$PASS $DB $x > $x.sql
  15. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement