How to easily migrate your Moodle website to new host

Hi guys, thought of sharing my learning on how to move your moodle website from one hosting service provider to a new one by yourself. Here are the steps:

  1. Logon to the Cpanel of your existing host
  2. Click phpMyAdmin available under Databases section
  3. Select the database for your moodle site
  4. Click Export, it will save your .sql file in your local computer. Keep it safe.
Export sql database from Cpanel

5. In the Cpanel, go to File Manager and Compress the folder where you installed your Moodle site , mostly it will be public_html

6. Also Compress the moodle data folder (it will be outside your public_html )

7. Login to a FTP client (i.e.,FileZila etc) with the credential of your old host.

8. Download both the compressed folder you created in step-5 & 6.

9. Open another instance of FTP client and log on to your new host

10. Upload both the compressed file in respective locations

11. Log on to Cpanel of new host

12. Extract both the compressed folder in correct location.

13. Go to the Databases section of the Cpanel of new host.

14. Create a new database from the create new database option:

15. Go down in the same page, and create a new user, by choose user name and password, keep them safe.

16. Add the newly created user to the database, and give all profligates

17. Go to phpmyAdmin of the new host, you should see the database name you just created, click on it and click import, select the sql file downloaded from your old host.

18. Go to the home folder (mostly public_html) which you extracted in step-12.

19. Right click and edit it as below:

$CFG->dbname    = 'YOUR-DATABSE-NAME';
$CFG->dbuser    = 'YOUR-DATABASE-USER-NAME';
$CFG->dbpass    = 'YOUR-DATABSE-USER-PASSWORD';
$CFG->prefix    = 'PREFIX-OF-THE-TABLES-YOU-WILL-FIND-FROM-PHYMYADMIN';



$CFG->wwwroot   = 'https://XXXX.COM/XXX';//SITE URL
$CFG->dataroot  = '/XXXXX/XXX/XXXX';//PATH OF YOUR DATA DIR
$CFG->admin     = 'admin';

20. Login to your domain name provider, and change the name servers name to your new host.

And, congratulations! you have successfully done the migration of your moodle site to new host.

Please drop your comments about your experience on Moodle migrations. In case you like to avail our paid consulting service on this or any web development projects, contact us, if you are looking to start your e-commerce business, we have various special packages to make your journey smooth.

Leave a Reply