How to migrate moodle and DB to different server

How to migrate moodle and DB to different server

by Rob Yamry -
Number of replies: 4

I have a moodle (v1.9.5, running on SLES10 and MySQL) installation that I would like to move to a different server altogether.  Is it as easy as copying the moodle directory and the db to the new server?  Is there any How-Tos out there for this?  The new server is SLES10 and runs MySQL as well.

Thanks!

-Rob

Average of ratings: -
In reply to Rob Yamry

Re: How to migrate moodle and DB to different server

by Colin Fraser -
Picture of Documentation writers Picture of Testers

The issue is not the environment, well not entirely, but if you are going to be using essentially the same environment, the issue then becomes the domain name itself. You will need to  change the config.php file to reflect the new IP and inside the database there are a number of places where the IP is mentioned. I have never used it, but I understand there is a script available that will update the database when run, to show a new IP. I am not sure where it is, you may have to search the Modules and Plugins area, and I seem to recall it being talked about in conjunction with phpMyAdmin. This is not an uncommon thing so I am surprised there isn't a step by step guide in Moodle Docs about it..

In reply to Colin Fraser

Re: How to migrate moodle and DB to different server

by Mat Simon -

It's not the IP address but the URL that is stored in config.php and the DB - thanks to this discussion I learned about that smile

I think this points you to the right direction and is pretty easy if you have a shell access, see

http://docs.moodle.org/en/Moodle_migration

And if you have a shell, follow method 2 using admin/replace.php

In reply to Mat Simon

Re: How to migrate moodle and DB to different server

by Mat Simon -
Just as addition I do think the replace.php method is quite unsafe - you don't exact know what it changes since there is no real feedback. I tried this on my test system and tried replacing with empty values. - Fortunately it seems is has not changed anything. If you can dump the DB, you can first do a grep "myOldURL" myDB.dump and see where there are old entries. After that you can run the sed-Command as described and compare another time with grep and the new URL if everything was changed correctly. This way you only mess up a backup DB and not a DB that is running. Looks preferable to me.
In reply to Mat Simon

Re: How to migrate moodle and DB to different server

by Rob Yamry -

Thanks for the responses everyone.  The move was to another server that I manage.  I searched around a bit more after I posted and found the migration steps and followed step two.  It went very smoothly and everything is good today.  It was to the same URL (just changed DNS records) so everything went over quite smoothly and didnt have to mess with the replace.php.

Thanks again for the help!

-Rob