public
Last active

Convert MyISAM tables to InnoDB

  • Download Gist
gistfile1.sh
Shell
1 2 3 4 5 6 7
## Copied from: http://technotes.twosmallcoins.com/?p=356
 
# Get table listing and generate ALTER sql file
$ mysql -u foobar -p -e "show tables in <database> ;" | tail --lines=+2 | xargs -i echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
 
# Execute ALTER sql queries generated to convert from MyISAM to InnoDB:
$ mysql -u foobar -p <database> < alter_table.sql

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.