Possible Duplicate:
How do I convert a database from MyISAM to InnoDB?

Due to a bug in the Backup and Migrate module http://drupal.org/node/1128620 , all of my DB tables were reverted to MyISAM. How to return them all back to to InnoDB. (Perhaps using phpmyadmin?)

I used to use http://drupal.org/project/dbtuner/ in D6 for this. However there isn't a D7 version.

Also, are there any side effects or possible gotchas for switching this in this way?


    // connect your database here first 
    $sql = "SHOW tables";
    $rs = mysql_query($sql);

    while($row = mysql_fetch_array($rs))
        $tbl = $row[0];
        $sql = "ALTER TABLE $tbl  ENGINE=INNODB";

What do I need to add to the section "connect your database here first" to connect to my Drupal DB?

  • Any simple instructions for doing this in phpmyadmin? – chunkymunky Jul 2 '12 at 21:10
  • THe following does not workSELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=InnoDB;') FROM information_schema.tables WHERE engine = 'MyISAM'; – chunkymunky Jul 2 '12 at 21:30

The easiest way is to take a backup with Backup and Migrate, open it in an editor and search/replace "MyISAM" to "InnoDB". Then restore it.

Personally, I would restore to a new catalog, and then switch the database in settings.php. This way, you can test before making the new version live.

Otherwise, this is a dup of How do I convert a database from MyISAM to InnoDB?

Not the answer you're looking for? Browse other questions tagged or ask your own question.