Alternative migration process

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Alternative migration process.

Moodle1.6


If you are looking for an alternative migration process with PostgreSQL server, try this page.

If, to meet Moodle 1.6 requirement, you are upgrading your MySQL server also, you can apply this strategy (tested converting database from MySQL 4.0.x to 5.0.x):

  • ensure your Moodle site use only one encoding (eg. all courses use a latin1/ISO-8859-1 language)
  • put your Moodle site off line
  • export your data from old server; MySQL 4.0.x uses 8 bit encoding by default, so data will be dump in the same encoding of your Moodle site:
mysqldump -h <old mysql host> -u <moodle db user> -p <old moodle db name> > dbdump.sql
  • upgrade your MySQL server
  • upgrade your Moodle; remember to install UTF-8 version of all require languages
  • create your new Moodle database and set appropriate privileges
  • re-import your data (MySQL 5.x uses UTF-8 encoding, suppose your data is ISO-8859-1 encoded)
mysql -h <new mysql host> -u <moodle db user> -p --default-character-set=latin1 <new moodle db name> < dbdump.sql
  • MySQL will convert character encoding automatically.
  • Now, you must update some data; from a mysql console:
update mdl_config set value=concat(value, '.utf8') where name='locale';
update mdl_config set value=concat(value, '_utf8') where name='lang';
update mdl_course set modinfo=null;
update mdl_course set lang=concat(lang, '_utf8') where length(lang) > 1;
update mdl_user set lang=concat(lang, '_utf8') where length(lang) > 1;
update mdl_config set value='1' where name='unicodedb';

  • update your Moodle config.php to use new server and uncomment $CFG->unicodedb = 1;
  • put your Moodle site back on line .

For a medium size database, migration require only 3-4 minutes.