Created
June 13, 2010 19:10
-
-
Save smerrill/436905 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Variables definitions | |
DBNAME="tony_local_test" | |
MYSQL_COMMON="-uroot -D$DBNAME" | |
SQL_QUERY="SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = '$DBNAME' AND ENGINE='MyISAM';" | |
ALTER_TABLE_QUERY="" | |
# Build up one giant SQL string. | |
for i in `mysql $MYSQL_COMMON --skip-column-names -s -e "$SQL_QUERY"`; do | |
ALTER_TABLE_QUERY=$ALTER_TABLE_QUERY"ALTER TABLE $i ENGINE=InnoDB;" | |
done | |
# Execute that long-ass query. | |
mysql $MYSQL_COMMON -e "$ALTER_TABLE_QUERY"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment