The linux bash/shell script to convert mysql database from myisam to innodb.
FIrst backup database before running this script.


#!/bin/bash
# MyISAM to InnoDB converting script
DBNAME="database";
DBUSER="user";
DBPASS="pass";


for t in $(mysql -u$DBUSER -p$DBPASS --batch --column-names=false -e "show tables" $DBNAME);
do
echo "Converting table $t";
mysql -u$DBUSER -p$DBPASS -e "alter table ${t} type=InnoDB" $DBNAME;
echo "Repair table $t";
mysql -u$DBUSER -p$DBPASS -e "repair table ${t}" $DBNAME;
done