Cloud Guru Online

We simplify everything!

MySQL – Convert all tables from MyISAM to InnoDB

1. Convert the engine using the below command and dump the database.

mysql -e "SELECT concat('ALTER TABLE ', TABLE_NAME,' ENGINE=InnoDB;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = 'successc_wordpress' AND ENGINE = 'MyISAM' AND TABLE_TYPE = 'BASE TABLE'" | tail -n+2 >> alter.sql

2. Restore the dump created above to the original database.

mysql original_database < alter.sql

Leave a Reply

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