Thursday 10 November 2011

Script to convert all tables to InnoDB

Here is a quick shell script to convert all tables in a database to InnoDB. No dependancies other than a command line prompt on a Unix like system and the standard MySQL tools:

for T in `mysql -u root -B -N -e “show tables” test`; do mysql -u root -e “alter table $T type=innodb” test; done

Replace “test” with the target database. This pattern is also great for optimizing or analyzing your MyISAM tables.

No comments:

Post a Comment