Created
November 2, 2012 15:57
-
-
Save jpetazzo/4002239 to your computer and use it in GitHub Desktop.
Convert all databases and tables to InnoDB
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/sh | |
MYSQL="mysql --skip-column-names --batch" | |
for DB in $($MYSQL -e "show databases" \ | |
| grep -v ^information_schema$ \ | |
| grep -v ^mysql$ | |
) | |
do | |
for TABLE in $($MYSQL --database $DB -e "show tables") | |
do | |
echo -n "$DB.$TABLE | $(du -sm /var/lib/mysql) | " | |
$MYSQL --database $DB -e "ALTER TABLE $TABLE ENGINE=InnoDB" | |
du -sm /var/lib/mysql | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment