There comes a time in most websites’ lifetime when it is necessary to transfer to a new web host. Hopefully, your reason for transferring when the time comes is due to a substantial rise in traffic and you require greater resources to handle it, and not because of a troublesome web host. At that time, the availability of your website is crucial and there is no room for downtime if you’re building your business online, since this can mean missed opportunities.
Here’s a simple tutorial to help you complete the web host transfer with absolutely zero downtime and without hiring a professional to take care of the task for you.
Step 1 – Backup All WordPress Files
Once you have your new hosting account ready and activated, you can start creating a copy of your existing files with your current web host. Login to your old web host’s control panel and navigate to your File Manager. The folder you will need to backup is the one that contains all WordPress content including images and core files. This is usually within the public_html folder as shown below.
The simplest method for backing up these files is to select all files and folders within the directory and execute the compress command which will compress all files within the folder into one manageable zip file. The option usually looks like either image below:
Step 2 – Optimize Your Database
You will be creating a backup of your WordPress database but before you do, you will need to optimize your WordPress database tables. An easy way to do this is to use the optimize tables option with the WP-DB Manager plugin. This is necessary to reduce the size of your database backup.
Step 3 – Disable all Plugins
Login to your WordPress dashboard and disable all plugins.
Step 4 – Backup your WordPress Database
Login to your old hosting account and select your phpMyadmin or manage MySQL option to gain access to your databases. Create a backup of your WordPress database and download the SQL copy to your computer.
To backup your database within phpMyadmin:
Once you’ve completed the steps in the diagram scroll to the bottom of the screen and select “Go.” This will download the SQL file to your computer.
Step 5 – Upload the Downloaded Zip File
Login to your new hosting account and upload the compressed file you downloaded in Step 1. This should be uploaded to your root directory. Once uploaded, go ahead and extract the files to the directory. You will then see that your WordPress folders and other content are now present.
Step 6 – Create The New Database
Within your new hosting account, you will need to create a new database. Most web hosting accounts provide a “Database Setup Wizard” that will take you through the steps for creation. Use this option and it will allow you to assign the database name, user, password and account privileges. Ensure the user is assigned all privileges and copy all these details to your notepad for use later.
Step 7 – Restore Backup Database
Within your new host, select your phpMyadmin option and select the database you created in Step 6. After selecting the database, you will notice that it has no tables. Then you should select the Import tab to import the old tables into the new database.
Click “Browse” to search for the database backup file you downloaded in Step 4, then select “Go.” This will begin the upload process which can take a while depending on the size of your database backup file.
Take note of the maximum file upload size on this screen as you will not be able to upload anything larger. If it is larger then you would need to contact your new host’s tech support.
Step 8 – Edit the wp-config.php File
Browse to the file manager of your new hosting account and search for the wp-config.php file within the root directory. This is where you will enter your new database details. As shown below, edit this file with the new database credentials and save.
Ensure that you download a backup copy of the wp-config.php so that you can revert to the backup in case you make any major mistakes.
Step 9 – Assign The New Name Servers
Now that all files and database tables have been transferred to the new hosting account, its time to change the name servers so that they point to the new host provider. Usually, the name server is displayed along with general statistics and account details. However, if you can’t find it then contact tech support.
The name server normally takes the format of ns234.hostprovider.com & ns235.hostprovider.com.
Your host provider will tell you that it takes up to 72 hours for the new names to propagate but it usually takes about an hour or two. As long as you following the steps above accurately you will not even notice when the change is complete.
Conduct Thorough Testing
Ensure that once the transfer is complete you conduct a thorough testing of all plugins and features of your site and WordPress dashboard to spot any potential problems.
That’s it, you have successfully transferred your WordPress site to a new host.
If you receive the error message “Error establishing a database connection” after the transfer takes place then you will need to check to ensure that you entered your database credentials correctly in the wp-config.php file and that it is uploaded to the new host directory.
If you experience any difficulties or would like to contribute a better idea for making this process more efficient, feel free to leave us a comment below.