Step 1: Back Up Your moosocial’s Files
The very first step of any project such as this is to back up every aspect of your site. This step is good practice before any major change but it is also a requirement of migrating your moosocial installation.
There are many plugins out there that will completely backup your site for you. This backup, however, requires a more manual approach. Using an FTP program (such as FileZilla), connect to your web host and copy all files under your website’s directory to a folder on your local computer.
This includes the .htaccess file that is set to be hidden. Consult your FTP program’s help file to have it display hidden files if you are unable to see this file.
Depending on the number of media uploads you have in your site, this could take some time. While this download is underway we can begin step two and make a copy of your database.
Step 2: Export The moosocial Database
Exporting your database is a simple process that only requires a few steps to complete. Login to the cPanel account of your web server and open the phpMyAdmin application. Select the database that contains your moosocial installation from the list on the left-hand sidebar and once selected click on the Export tab on the navigation menu.
The default settings of a Quick export and the SQL format for the export are sufficient for what we need. Click the Go button and the database export process will begin and a file will be downloaded to your local computer.
Once the database export and the FTP transfer of your files have both completed, you are ready to move onto the next stage.
Step 3: Create The moosocial Database On Your New Host Server
Before we can begin the migration to the new web host, we need to create an environment for a moosocial installation. To do this you must create a database that you can import your SQL data into.
Login to your new web host with the user credentials they have supplied you and connect to the cPanel software. For our guide, we will be using the MySQL Databases application. If your web host doesn’t have that application running then you will contact their support team to discover their method of creating new databases.
The steps to create a database are quite simple:
- Open MySQL Database and create a new database with an appropriate name for your website.
- Create a new MySQL user (with a secure password).
- Add this user account to the new database and grant it All Privileges.
Write down the database name, the new MySQL username, and its password. You will need them soon.
Step 4: Edit the config.php File
Browse to the folder on your local computer where you downloaded your website files to. In that folder, there is a file called app/config/config.php that controls the access between moosocial and your database.
Make a copy of this file and store it in another folder on your local computer. This is necessary for restoring the changes we are about to make should something go wrong later.
Open the original version of the file with your favorite text editor and make the following three changes:
1. Change The Database Name
Locate the following line:
The db_name portion of this line will currently be set to the MySQL database name of your old web host. This must be changed to the name of the new database you have just created.
2. Change the Database Username
Below this you will find the line:
In this line you need to change the db_user portion from the username of your old host to match the new username you have just created.
3. Change The Database User Password
Finally, edit the third line:
As with the others, the db_pass section of this line must be changed to the new secure password you created for your MySQL user.
Save config.php and close the file.
Step 5: Import Your Database
Now that you have a new database to work with we can begin the import process.
Launch phpMyAdmin from the cPanel software on your new server and select your new database from the list on the left-hand sidebar. Once it opens select the Import tab from the navigation menu.
In the File to Import section click the Choose File button and select the SQL file you exported previously.
Un-tick the Partial Import check box, make sure the format is set to SQL and then click the Go button. The database import will now begin.
The time this import takes varies depending on the size of your database. You should receive a message informing you of the success of the import when it has finished.
Step 6: Upload The moosocial Files To Your New Host
Now that you have the new database prepared and you’ve reconfigured the config.php file, it is time to begin uploading your website’s files.
Connect to your new web host using your FTP program and browse to the folder that your website is going to be held. If this is the primary, or only site being installed on this web server then uploading the files to the public_html folder is the usual directory.
With the remote directory selected you can upload your website files that should now include the updated version of config.php. As with the earlier download, this process can take some time.
Don’t delete these files from your local computer once the upload finishes. They are still needed until the final steps have been completed.
As you can see, when broken down into the above simple steps, the process isn’t that difficult. All it really requires is for you to be careful at each step and give yourself the option to go back to the original version until the last possible moment (in case of any problems).
Have you migrated your moosocial website recently? Let us know your experience with the process in the comments section below!