Convert Existing MySQL Database to Innodb
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.
1. Create a file convert_innodb.sh with the below code
#!/bin/bash DATABASENAME="database_name" 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 convert_innodb.sh
3. Execute the script using