Contents

Why migrate to InnoDB?

Starting from Moodle 2.9 MyISAM is no longer supported. InnoDB works more robustly, performs better with big sites and allows better data integrity features (transactions).

MySQL Configuration

Before attempting to change the table type, you should:

check InnoDB is enabled. Log in to MySQL and run the command SHOW ENGINES. Make sure that support for InnoDB shows either "YES" or "DEFAULT".

set innodb_file_per_table if required. This setting can be useful for large installations, but it only affects newly created tables and can't be applied retrospectively.

Various Methods described in Moodle forums (choose one)

RECOMMENDED: use the CLI script - php admin/cli/mysql_engine.php - requires access to shell, and the config.php must only have one moodle instance

Make sure nobody else is accessing the server while performing the following. Put Moodle into maintenance mode. As an administrator, run the innodb script as a webpage http://www.YOUR_MOODLE_SITE/admin/tool/innodb/index.php. (With large databases, you may experience time-out issues.) Add the following statement to /etc/my.cnf under the [mysqld] heading: "binlog_format=ROW" (without the quotes) and stop/restart MySQL. Without this statement you will encounter the dmlwriteexception error when moodle attempts to write to MySQL. Take Moodle out of maintenance mode.

use PHPMyAdmin entering Structure view of a table and clicking Operations tab. Look for Storage Engine parameter. This is a tedious task due to the number of tables [1]

perform a database dump (e.g. mysqldump moodle_database > dump.SQL), use an editor or sed/perl/awk command to find/replace , replacing MyISAM with InnoDB. Finally, restore back in the server. (e.g. mysql < dump.SQL or equivalent). If using this method, be very careful to use the same file encoding on both input and output.