Converting existing MySQL Database Tables from MyISAM to InnoDB can be done from PHPMyAdmin but if there are too many tables the following script may help you to convert all the tables of a particular database to InnoDB


1. This tutorial assumes that you have .my.cnf configured with MySQL credentials for auto-login
2. You have full privileges over the Database that you are trying to convert.
3. Take a backup of the database so that you can restore when things go wrong.

How to:

1. Create a file with the below code



for t in `echo "show tables" | mysql --batch --skip-column-names $DATABASENAME`; do mysql $DATABASENAME -e "ALTER TABLE \`$t\` ENGINE = InnoDB;"; done


2. Give execute permission for the script

chmod 755


3. Execute the script using