Skip to content

Instantly share code, notes, and snippets.

@bageljp
Created February 19, 2014 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bageljp/9083937 to your computer and use it in GitHub Desktop.
Save bageljp/9083937 to your computer and use it in GitHub Desktop.
mysql utility.
#!/bin/bash
MYSQL_DB="$1”
MYSQL_HOST=“${2:-localhost}”
MYSQL_PASS="${3:-password}"
mysql -u root -p${MYSQL_PASS} -h ${MYSQL_HOST} -s ${MYSQL_DB} -e "show tables;" | grep -v Tables_in_ | while read line; do
echo "== ${MYSQL_DB}.${line} ============================================================================="
mysql -u root -p${MYSQL_PASS} -h ${MYSQL_HOST} -s ${MYSQL_DB} -e "show create table ${MYSQL_DB}.${line};" | grep ENGINE | grep -v 'ENGINE=InnoDB'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment