Rebuilding a moodle site

Rebuilding a moodle site

by Ron Banks -
Number of replies: 2

Scenario:  I have installed a moodle site and have it backed up as per the upgrade installations.  I have copied all the site files, I have copied the data directory and have created a backup file using mysqldump as per the instructions.

Now, I want to move that site and build it back up.  How do I do that?  I have looked at the mysqlimport command but it seems to want to only install data in one table and is giving me an error because I have not renamed the backup file as one of the table names?  How do I rebuild the entire database from the backup so I can restart the site somewhere else?

... and ... is this documented somewhere?  I know Moodle's site was changed recently to a different server, was there documentation created that we can learn from?

Thanks,

Average of ratings: -
In reply to Ron Banks

Re: Rebuilding a moodle site

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ron,

to recreate your database contents you don't have to use the "mysqlimport" command. It is used to load "text files" into existing tables.

Instead, do this:

1.-Create your new (empty) Moodle database:

See Step 5 of installation process.

2.-Execute your "mysqldumped.sql" file against that new database:

mysql NEWDATABASENAME < mysqldumped.sql
(obviously you'll have to use the -u, -p and -h to specify your database user, password and host).

Hope this helps, ciao smile

PS: The "mysqldump" utility generates a "standard sql script" that can be executed once logged into any MySQL database. For your info, only...
In reply to Eloy Lafuente (stronk7)

Re: Rebuilding a moodle site

by Ron Banks -

Ahhh, the simplicity of it all.

Well, Eloy, now you know my level of expertise with MySQL databases!  Thank you very much for your help and guidance.  You are appreciated.

Ron