Converting from MyISAM to InnoDB

To change the default table engine add the following to my.cnf:

default-storage-engine=InnoDB

To check the engines being used:

SHOW TABLES STATUS

Each existing table has to be converted explicitly:

user='mydba'
db='mydb'
mysql -u ${user} -p -e "SHOW TABLES IN ${db};" \
| tail -n +2 | xargs -I '{}' echo "ALTER TABLE {} ENGINE=INNODB;" > alter_table.sql
mysql -u ${user} -p -D ${db} < alter_table.sql

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top