Change database from myisam to innodb

boyforeigner

Well-Known Member
May 18, 2003
46
0
156
How to change database from myisam to innodb, I just want the database, tables are already changed. (MySQL 5.0)
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
InnoDB is a Table type, not a Database type. If you already converted the tables, then you are done.
 

sabarishks

Active Member
Jun 29, 2007
35
0
56
Take a backup before proceeding.

This script is used to convert the whole mysql database to innodb.

#/bin/bash
#script to convert the whole database to innodb format.
cp -iRfp /var/lib/mysql /var/lib/mysql-$(date +%s)
for mydatabase in $(mysql --batch --column-names=false -e "show databases");
do
for t in $(mysql --batch --column-names=false -e "show tables" $mydatabase);
do
mysql -e "alter table $t type=InnoDB" $mydbname;
echo "converted "$t" to innodb"
done
done