Making any significant changes to your website can be a nerve-wracking decision, especially if you’re thinking of moving your WordPress site to a new host. One of the biggest risks/fears business owners face when it comes to moving their website to a new hosting company or server is the possibility of losing important website files or experiencing downtime. We’ve got the information you need to successfully export your WordPress database and move your WordPress site to a new host with minimal interruption to your site’s availability.
Migrating Your WordPress Site: With a Plugin or Manually?
Migrating a WordPress site may sound intimidating, but it’s not necessarily difficult to do. You can move your WordPress site manually, but you’ll have to be comfortable with using File Transfer Protocol (FTP) or Secure File Transfer Protocol (SFTP) — this, according to WordPress, “will transfer your files and password over a secured connection.” If you choose to manually migrate your WordPress site, you may need to contact your new website host to have SFTP enabled on your account. You’ll also need to be comfortable with accessing databases and modifying the files on the backend of your website.
If you’d rather use a WordPress migration plugin to move your WordPress site, there are several options to choose from, including Duplicator, WP Engine Automated Migration, WPvivid Backup plugin, WP Migrate DB, and All-in-One WP Migration. Keep in mind, if you have a larger website, you might run into errors if you try to use a migration plugin. As such, manual migration might be the better option if you’re trying to migrate a larger website.
When you’re searching for a new hosting platform, be on the lookout for companies that will migrate WordPress sites to a new host for free for new subscribers. This could be a great, cost-effective solution to successfully move your WordPress site.
Moving a WordPress Site with a Plugin
As I mentioned before, there are several options available if you want to use a plugin to move your WordPress site to a new host (WPBeginner provides comprehensive instructions for moving a WordPress site with the Duplicator plugin). Using a migration plugin can provide you with an insurance policy of sorts because many, if not all, of those plugins, create a backup of your site in addition to offering recovery services if something goes wrong during the migration process. If you only need to move a portion of your website, there are plugins that you can customize to meet your website migration needs.
Moving a WordPress Site Manually
With a little preparation, you can manually move your WordPress site yourself. To do so, you’ll need to perform the following steps:
- Back up your website files
- Export the WordPress database
- Create the WordPress database on the new host server
- Edit the wp-config.php file
- Import your database
- Upload the WordPress files to your new host
- Final touches
I’ll expand on each of these steps below.
1. Backing Up Your Website Files
Once you’ve decided how you want to migrate your WordPress website, you’ll need to backup all of your website files before you can start moving your WordPress site. Technically, this should be part of your general WordPress security protocol, but you should definitely do this before you make any major changes to your website. There are plenty of plugins you can install to do this rather than having to complete this process manually.
These plugins have built-in tools to help manage which files you want to back up, where you want to store your backed up files, and how often you want your files backed up. This process could take a while depending on how many files, especially media files, your website houses. While the backup plugin is working, you can move onto the next step to get your website ready to move: making a copy of and exporting your WordPress database.
2. How to Export Your WordPress Database
To export the WordPress database for your website, you’ll need to log into your web server’s cPanel account and open the phpMyAdmin application. Select your WordPress database from the list on the sidebar on the left and click Export on the navigation menu. You can leave the default Quick Export and SQL format export settings. Click Go to begin the export process. Once the process is complete, a file will automatically download to your computer.
3. The WordPress Database Migration Process
To be able to successfully move your WordPress site to a new host, you’ll need to create a database that will allow you to import your SQL data. You’ll need to log into your new host account and connect with the cPanel software. I’m using MySQL Database for this example, but if your new host provider doesn’t have that application, contact customer support to find out how they create new databases in their system.
To create a new database:
- Open MySQL Database and create a new database for your website.
- Choose a new MySQL username and password.
- Add this account to the new database and grant All Privileges to that user.
Be sure to remember the name of the new database as well as your new MySQL username and password — you’ll need them in the coming steps.
4. Editing the wp-config.php File
At the end of the process to export your WordPress site’s database, a file was automatically created and downloaded to your computer. Within that file, there is a folder called wp-config.php, which controls the access between WordPress and your database. For this step, you’re going to need to edit this folder to be able to move your WordPress site to a new host.
*First, make a copy of the original wp-config.php file and save it to another folder on your computer in case something goes wrong during this process.
Once you’ve made a copy of the file, open the original file in a text editor and make the following three changes (you’ll need the name of the new database as well as your new MySQL username and password for this step):
- Change the database name. Look for the following: define(‘DB_NAME’ , ‘db_name’);
- The db_name portion of this line will be the name of the MySQL database of your old website host, so you need to change to the name of the database you just created.
- Change the database username. Below the database name line is the following: define(‘DB_USER’, ‘db_user’);
- You’ll need to change the db_user to the new username you just created for your MySQL user.
- Change the database password. The next line contains the database password for your old database: define(‘DB_PASSWORD’, ‘db_pass’);
- You need to change the db_pass section of this line to reflect the new MySQL password you chose.
Save the changes you made to the wp-config.php file and close it.
5. Import Your Database
Now that you’ve created your new database, you can start to import your website files to move your WordPress site to the new host. On your new server, open the cPanel software and launch the phpMyAdmin application. Select your new database from the pre-populated list on the left side of the screen.
Once your database opens, click Import on the navigation menu. In the File to Import section, click Choose File and select the SQL file that you exported before. Click to uncheck the Partial Import check box and make sure that the format is set to SQL. Click Go to begin the database import process. Depending on the size of the database you’re importing, this part could take a while. A message will appear on your screen once the import is complete.
6. Uploading the WordPress Files to Your New Host
Once the new database is ready and you’ve updated the wp-config.php file, you can start uploading your website files to the new host. Using your FTP program, connect to your new hosting platform, and select your website files from the folder. Upload your files to the public_html folder if this is the only site you’re installing on this server. Once you’ve selected the correct remote directory, upload your website files, including the updated wp-config.php file. Keep in mind that this process can take a while to complete.
Be sure to keep all of your website files until the entire process of moving your WordPress site is complete.
7. Finishing Touches
This part of moving your WordPress site is actually two sets of steps that can be completed over the course of several days. To start, before you can use the site on your new host’s platform, you’ll need to reconfigure your domain’s DNS settings so that the correct records will point to the new server’s IP address. This process is dependent upon where your domain is registered, so you’ll need to refer to your domain registrar for the instructions to make this change.
Keep in mind that DNS changes can take up to 48 hours to complete. During those 48 hours, try to avoid making any changes to your website because you could wind up making those changes to the old version of your site. After 48 hours, you should be able to access your new website host. Once you’re able to do so, you can log in to your old website host and delete your website’s files and database.
Be sure to always keep a copy of your website files, your database, and the original wp-config.php file even after you’ve successfully moved your WordPress site to a new host.
Need Help Moving Your WordPress Site to a New Host?
If you need hands-on guidance for or additional help with moving your WordPress site to a new host, we’ve got your back! We have over 10 years of experience in WordPress website management, including updating WordPress themes/designs, adding new functionality to your WordPress site, and configuring WordPress hosting and backups. Contact us today!
*Image Credits: WPExplorer
- Guest Blog Posting Tips and Tricks — My Two Cents on the Subject as Quoted in a Recent SE Ranking Article - October 12, 2020
- Why Your Google Ranking Keeps Changing - September 28, 2020
- How to Move a WordPress Site to a New Host - September 21, 2020