Can I convert Innodb with foreign directly into mysiam?
I want to conv开发者_如何转开发ert the db with innodb tables into myisam, all of them. How can I do these? there are some foreign keys exist among tables.
how can I make this in the best way?
You can't convert directly from InnoDB to MyISAM while the foreign keys are still there. You have to remove the constraints first. To do this, for each table follow these steps:
- Issue
SHOW CREATE TABLE tablename
- For each CONSTRAINT ... FOREIGN KEY declaration in the output, you will need to issue
ALTER TABLE tablename DROP FOREIGN KEY x
wherex
is the identifier that appears betweenCONSTRAINT
andFOREIGN KEY
. - Issue
SHOW CREATE TABLE tablename
again. The foreign key constraints may have left behind indexes (since InnoDB requires an index on each foreign key, and it won't necessarily remove them just because you have removed the constraint). For each index you decide you no longer want, issueALTER TABLE tablename DROP INDEX indexname
.
Once you have done this for all tables that are involved with constraints, you can convert tables to MyISAM individually using ALTER TABLE tablename ENGINE=MYISAM
.
精彩评论