A step by step guide to Migrate WordPress from one Host to another Host
Shifting your website to a new server is very stressful experience and the biggest risk is when migrating website to a new host is data loss and potential downtime. Many people have faced the problem with there hosting provider and decided to move to a new server but migrating to a new server is very risky and there is a fear of making mistake and damaging your site.
But Migrating website to another server is nothing to be concerned. Follow below steps to migrate your website to the new server.
Step 1: Backup your WordPress files Using FTP or directly from cpanel
The first step is to make the zip/Compressed file of all your WordPress files by directly going into the cpanel or by FTP program ( such as FileZillalla )and connect to your server and copy all files from the public_html directory and compress the file in zip format as shown in below image I have made website.zip file in Public_html.
Step 2: Export the Database of your website
Now our second step is to export/Download WordPress Database. Exporting Database is very simple login to your Cpanel account and open phpMyAdmin from Database Section.
Once you open phpMyAdmin You will see your database which has WordPress installation Select the database from left-hand side Sidebar and click on Export.
In some cases, if there is more than One database in phpMyAdmin and you want to identify which is your site’s Database simply open the wp_config.php file from public_html and check for below given code.
define( 'DB_NAME', 'database_name_here' );
In place of ‘database_name_here’ your actual database name will be there so in this way you can identify which is your site’s Database.
Now after selecting your Database and clicking on Export you will see 2 Types of Export method
Quick: This method is very simple If you select quick Method and Hit Go Button Your Database is successfully exported.
Custom: Here you can customize your database exporting (Ex: You can Exclude some tables, Compression of file etc)
The default Method Quick and SQL Format are sufficient for what we need. Now hit Go button and database file is Start downloading.
Step 3: Create Database in new Server/Host and Import Database
To import your database in the new server first you need to create the database. Creating new database is very simple follow the below steps to create a new Database.
The steps to create a database are quite simple:
- Open MySQL Database Wizard 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 the Database.
Now you have successfully created Your database, Our next step is to import Database.
Follow below steps to import Database.
- Open phpMyAdmin In your new Server
- Select your newly created Database from the left sidebar
- Click on import Tab from the menu ( As shown in Below Image )
- Now in Import section click on choose file to Import Database
- Uncheck Partial Import check box
- Select Format as MYSQL
- Hit Go Button now your database start importing this takes time depending on the file size.
- Once Import is completed you will get a confirmation Message for the successful import of Database.
Step 4: Upload your WordPress files to New Host/Server
To Upload your WordPress files to New Server connect to your Server using FTP ( FileZilla ), To connect Using FTP you need to enter your domain name. But since your domain is still pointing to the old server, you will need to connect using server IP Address or server hostname you can find this in your server.
Once you connect using FTP Upload your WordPress archive .Zip file in Public_html and unzip that file
Step 5: Edit wp-config.php to connect your Database
Open wp-config.php file from the WordPress files which you have unzipped earlier and enter the details of your newly created database. Database name, Database username and User Password in the file
Change the Database Name
Replace new_db_name with your Database Name
Change Database Username
Replace new_db_name with your Database Username
Change the database user Password
Replace new_db_name with your Database Password
Step 6: Update your Domain Nameservers
At this point, you’ve created a complete copy of your WordPress database and files on your new hosting server. But your domain still points to your old web hosting account.
To point your website to the new server you need to switch DNS Nameservers.
Nameservers are Usually the couple of URL’s that look like this
Now login to your domain name providers website ( Ex: If domain name provider is Godaddy login in godaddy website ), Look for your domain name in the website. Depending upon the domain name provider the steps may be different but the concept is same.
Look for Nameservers section and Enter your new hosting providers Nameservers and Don’t forget to save.
You have successfully changed the nameservers. DNS changes can take 4 – 48 hours to propagate for all users.
We hope that this step by step guide helped you move WordPress to your new host.