Alternative migration process: Difference between revisions
From MoodleDocs
Helen Foster (talk | contribs) (content copied from Database migration) |
mNo edit summary |
||
Line 24: | Line 24: | ||
update mdl_course set lang=concat(lang, '_utf8') where length(lang) > 1; | 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_user set lang=concat(lang, '_utf8') where length(lang) > 1; | ||
update mdl_config set value='true' where name=unicodedb; | update mdl_config set value='true' where name='unicodedb'; | ||
* update your Moodle config.php to use new server | * update your Moodle config.php to use new server and uncomment '''$CFG->unicodedb = true;''' | ||
* put on line your Moodle site. | * put on line your Moodle site. | ||
Revision as of 16:05, 8 September 2006
Moodle1.6
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; remeber 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='true' where name='unicodedb';
- update your Moodle config.php to use new server and uncomment $CFG->unicodedb = true;
- put on line your Moodle site.
For a medium size database, migration require only 3-4 minutes.