Created
March 20, 2011 19:32
-
-
Save dplummer/878588 to your computer and use it in GitHub Desktop.
checking and altering table engines in mysql
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
# Find out what table engine your tables are using | |
select table_name, engine from information_schema.TABLES WHERE TABLE_SCHEMA = 'DATABASENAME'; | |
# From bash, set the engine on all tables in a database to InnoDB | |
# Where /etc/mysql/debian.cnf has the root password for your mysql box | |
# Taken from http://kevin.vanzonneveld.net/techblog/article/convert_all_tables_to_innodb_in_one_go/ | |
DATABASENAME="test" | |
for t in `echo "show tables" | mysql --defaults-file=/etc/mysql/debian.cnf --batch --skip-column-names $DATABASENAME`; do mysql --defaults-file=/etc/mysql/debian.cnf $DATABASENAME -e "ALTER TABLE $t ENGINE = InnoDB;"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment