Your Webhosting Questions
Answered by the Webhosting Experts
Tags
...
...

How to Migrate a WordPress Site

If you’re looking to migrate your WordPress Site from one host server to another via cPanel and aren’t sure where to begin, read on to learn how to easily transition your site without losing your data.

 

Migrating Your WordPress Site with cPanel

To migrate your WordPress site using cPanel, just follow these key steps.

Exporting Current WordPress Databases

Before you can move your WordPress site, you first have to export your databases.

  1. Log in to FTP with your cPanel username, either using Filezilla or your preferred FTP program.
  2. Next, navigate to the public_html folder and download the WordPress files, including .htaccess, onto your local computer.

    Screenshot showing the WordPress files contained in the public_html folder
  3. Now, log in to cPanel using your username and password. Under the Databases options, open the phpMyAdmin application.

    Screenshot of cPanel dashboard highlighting the phpMyAdmin application under the Databases options
  4. Within phpMyAdmin, select the database that contains your WordPress installation from the list on the left hand sidebar.

    Screenshot of the phpMyAdmin application highlighting the database list on the left
  5. Once you’ve selected the WordPress database, click on the Export tab on the navigation menu in the right hand side panel and save the file onto your local computer.

    Screenshot of the phpMyAdmin dashboard highlighting the Export option

  6. Once the database export and the FTP transfer of your files have both completed, it’s time to move onto the next stage.

 

Creating a WordPress Database on the New Host Server

To create a new MySQL database for your WordPress site:

  1. First, log in to the cPanel account on your new server and, under the Databases options, click on MySQL Databases.

    Screenshot of the cPanel dashboard highlighting the MySQL Databases option

  2. Next, under the Create a New Database option, create a new database with an appropriate name for your website.

    Screenshot of the MySQL dashboard showing the Create a New Database option
  3. After creating the new database, you’ll need to create a new MySQL User and assign them a secure password.

    Screenshot of the MySQL dashboard showing the Add a New User section

  4. Under the Add a User to a Database section, select your new user from the dropdown menu and add them to your new database.

    Screenshot of the MySQL dashboard showing the Add a User to a Database option

  5. Be sure to grant your new user all privileges by checking the box labelled All Privileges and then clicking on Make Changes.

    MySQL Account Maintenance, showing the option for All Privileges
  6. When you’ve finished, write down the name of your new database, the new MySQL username, and its password. You will need these for further configuration.

 

Editing the wp-config.php File

After creating your new database, the next step is to edit your WordPress site’s configuration files.

You can do that by browsing to the folder on your local computer where you downloaded your website files to in the first step of this tutorial. In that folder, you will find a file called wp-config.php. This file controls access between WordPress and your database.

Start by making a copy of this file and storing it in another folder on your local computer. Should anything go wrong during the process of making changes, this will allow you to restore to the previous version of the file.

Now, open the original version of the wp-config.php file with your favorite text editor and make the following three changes:

  1. Change the Database Name

    In the configuration file, locate the following line:
    define(‘DB_NAME’, ‘db_name’);

    The db_name portion of this line will currently be set to the MySQL database name of your old web host. You must change this to the name of the new database you just created.

  2. Change the Database Username

    After changing the database name, locate the line below it which says:
    define(‘DB_USER’, ‘db_user’);

    In this line, you will need to change the db_user portion from the username of your old host to the new username you just created for your new database.

  3. Change the Database User Password

    Finally, after editing the database name and user, edit the third line:

    define(‘DB_PASSWORD’, ‘db_pass’);

    As with the others, the db_pass section of this line must be changed to the new secure password you created for your new MySQL user.

Once all changes are complete, save the configuration file and close your text editor.

Importing Your Database onto a New Server

Now that your configuration files are ready, the next step in your site migration is to upload your WordPress database onto your new server.

  1. First, log in to cPanel and under the Databases options, open the phpMyAdmin application.

    Screenshot showing the databases options and highlighting the phpMyAdmin application
  2. Select your new database from the list on the left hand sidebar. Once it opens, select the Import tab from the navigation menu.
  3. In the File to Import section, click the Choose File button and select the WordPress SQL file you exported previously onto your local computer.

    Screenshot of the phpMyAdmin dashboard highlighting the Import and Choose File options

  4. Under Partial Import, un-tick the check box, and make sure the Format is set to SQL. Then, click the Go button. The database import will now begin.

    Screenshot of the phpMyAdmin dashboard, highlighting the Partial Import and Format options

  5. You should receive a confirmation message informing you of the success of the import once it has completed.

 

Uploading the WordPress Files to Your New Host

Once you’re databases are set and ready to go, it’s time to upload your WordPress files to your new hosting provider.

  1. Log in to FTP with your cPanel username, either using Filezilla or your preferred FTP program, and access your new host server
  2. Navigate to the public_html folder
  3. Now, upload all the WordPress files from your local computer that you downloaded previously, including the newly updated version of wp-config.php.

    Screenshot showing wordpress files uploaded to the public_html folder

 

Updating the Permalinks

At this point you should be just about finished with migrating your site. If you had permalinks set up on your dev site, you may notice that when you initially start clicking around the new, live site, that none of your pages are showing up when navigating away from the homepage.

To fix this:

  1. Log in in to your WordPress Admin Panel.

  2. Navigate to Settings.

  3. Locate the option for Permalinks and simply click Save Changes. WordPress will now create a new .htaccess file on your new server.

*Note: Sometimes WordPress will give an error message when trying to save your permalink settings, telling you it couldn’t create an .htaccess file. You can fix this by going into your web host’s file manager and creating a new file, named “.htaccess”, then making it writeable (permissions 777).

And there you have it! Your WordPress site should now have successfully migrated host servers without the loss of your data.

 

Popular Links

Looking for more information on WordPress? Search our Knowledge Base!

Interested in more articles about Web Design? Navigate to our Categories page using the bar on the left or check out these popular articles:

Popular tags within this category include: WordPress, FrontPage, SiteStudio, and more.

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

 

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: [email protected]. We are also available to you through our phone and live chat system 24/7/365.

Tags +
...