SHARE
TWEET

Untitled

a guest May 21st, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. MUSER="$1"
  4. MPASS="$2"
  5. MDB="$3"
  6.  
  7. # Detect paths
  8.  MYSQL=$(which mysql)
  9.  AWK=$(which awk)
  10.  GREP=$(which grep)
  11.  
  12. if [ $# -ne 3 ]
  13. then
  14.   echo "Usage: $0 {MySQL-User-Name} {MySQL-User-Password} {MySQL-Database-Name}"
  15.   echo "Change every tables to InnoDB in MySQL."
  16.   exit 1
  17. fi
  18.  
  19. TABLES=$($MYSQL -u $MUSER -p$MPASS $MDB -e 'show tables' | $AWK '{ print $1}' | $GREP -v '^Tables')
  20.  
  21. for t in $TABLES
  22. do
  23.   echo "Altering $t table in $MDB database..."
  24.   $MYSQL -u $MUSER -p$MPASS $MDB -e "ALTER TABLE $t ENGINE='innodb'"
  25. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top