How do I migrate Moodle to new a server?

How do I migrate Moodle to new a server?

by Cormac McClean -
Number of replies: 5
Hi,

After using Moodle for nearly a year (running on a desktop PC), we have secured a fully fledged, dedicated server to run Moodle (A Dell Poweredge 4600).

I want to migrate our existing courses, users and data to the new server. I have tried two approaches, neither of which has worked successfully:

1. Use the same version of Moodle (1.1.1) on the new server.
a) Installed Linux, Apache, MySQL, PHP and Moodle on the new server.
b) Archived the moodle data directory (moodle_uploads.tgz) and mysqldumped the tables from the current moodle system (moodle-backup.sql).
c) Copied the archived data directory (moodle_uploads) into the new server.
d) Tried to mysqlimport the moodle-backup.sql but I get an error:
Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-backup IGNORE 0 LINES' at line 1, when using table:moodle-backup

I haven't used mysqlimport before, and I'm not sure if this is the correct way to use a backup of the mysql tables.

2. Upgrade to the newest version of Moodle, 1.2
a) Installed Linux, Apache, MySQL, PHP and Moodle on the new server.
b) Archived the moodle data directory (moodle_uploads.tgz) and mysqldumped the tables from the current moodle system (moodle-backup.sql).
c) Copied the archived data directory (moodle_uploads) into the new server.
d) Copied the current config.php into the new Moodle directory.
e) Executed moodle/admin. At this point it spotted that there is a new version of moodle, and it went through a series of database updates, all of which were successful.

However, when I go to the main Moodle menu, I have no courses.

So my question is: how to I get the new moodle server to use the data from the current server?

Version numbers:
Current
Linux 2.4.7-10
Apache 1.3.28
MySQL 4.0.15
PHP 4.3.3
Moodle 1.1.1

New
Linux 2.4.20-8smp
Apache 2.0.48
MySQL 4.0.17
PHP 4.3.4
Moodle 1.2 (2004021000)

Any advice or suggestions would be appreciated.

Regards,
Cormac.
Average of ratings: -
In reply to Cormac McClean

Re: How do I migrate Moodle to new a server?

by Thomas Robb -
The 'easy way' would be do backup each individual course on the old server and then restore the courses on the new one -- or do you have so many courses that this would be too tedious to do?
In reply to Cormac McClean

Re: How do I migrate Moodle to new a server?

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Just copy all your database files directly ... ie you will probably find a directory full of the Moodle tables in /var/lib/mysql/moodle or something like that.  Make sure you shut down both MySQLs first, then restart them after the move.


In reply to Martin Dougiamas

Re: How do I migrate Moodle to new a server?

by Cormac McClean -
Many thank for your reply, Martin. That worked perfectly.

Regards,
Cormac.
In reply to Cormac McClean

Re: How do I migrate Moodle to new a server?

by Andy Diament -

I tried this one moving a setup from windows 2000 to Novell netware

Copy moodle dir from one web server root to another

copy moodle data to appropriate place

copy mysql data directory, called moodle, from one server to another; didn't bother with any archiving, backups, exporting or anything

made changes to moodle\config.php

and I think it worked!!

In reply to Andy Diament

Re: How do I migrate Moodle to new a server?

by Cormac McClean -
I hadn't thought of doing a straight copy of the moodle directory from one server root to the other.

As it happens, all I needed was to copy over the mysql/moodle directory. Now working perfectly.

Thanks,
Cormac.