Friday, October 8, 2010

INNODB to MYISAM

If you need to transfer your database which is INNODB formate to another server which engine is MYISAM
suppose test.sql is your database
You can check whic Engine it is used by using the command
# head -100 test.sql --> there you can see innodb or MYISAM

Our requirement is to restore the database to MYISAM however our server is supporting MYISAM. So we need to edit /etc/my.cnf line #skip-innodb to skip-innodb

Then execute the following perl script to change all Innodb terms in test.sql to MyISAM
perl -p -i -e "s/Innodb/MyISAM/" test.sql

Then restore the database
In some cases, database may be created by executing the commands in the dump file (for example if .sql file contains create database databasename)
So inorder to restore the dump just execute
mysql < test.sql

No comments:

Post a Comment