1. bluehost knowledge base

How To Migrate a WordPress Site - Import / Export WordPress Database

Overview

This article will explain how to migrate your WordPress site without using Marketplace.



Transfer your Files

  1. Connect to your current hosting account using FTP.

    Note: If you are unsure how to connect using FTP, please see our article Filezilla which explains how to set up Filezilla, a popular FTP program.

  2. Locate the directory that contains your WordPress site Files. This could be your public_html or a subfolder inside of the public_html.

    Note: Typically, you will need all of the files and folders beginning with "wp-."

  3. Using your FTP client, download these files to your computer.
  4. Now you need to upload those files to your new hosting account. You can use FTP to upload these files.
  5. Navigate to your public_html folder or the subfolder where you want WordPress installed.
  6. Upload the files from your computer to this new location.

For more information about FTP, you may check this article: FTP for Beginners.

Export the WordPress Database

  1. On your current hosting account, open the wp-config.php file. Located in this file is the name of the database that you need to export.
  2. Most cPanel based hosting accounts should provide a copy of PHPMyAdmin to access your database. You can use this to export the database as a .sql file.

    Note: If you don't have access to PHPMyAdmin, you can use a plugin to export your database's backup. If you're unsure where to access your wp-config.php file, please check this article, How To Find Your WordPress Database.

Create a New Database

You are now going to create a new database for the WordPress install.

  1. In your cPanel: Navigate to the Database category and click MySQL Databases.
  2. Please create a new database by typing in a name for it. This will be something like username_wp1, with 'wp1' being the name given to the database. 
  3. Now create a user for the database. You will provide a password for the user, which is important to remember for a later step in configuring WordPress.
  4. Once you have created the user, you will need to assign it to the database. When you do this, give the user All Privileges. (For a step-by-step guide on how to do this, please see: How to Create and Delete MySQL Databases and Users.)

Import into New Database

Now that you have a database created, you will import the .sql file you downloaded into it.

  1. In your cPanel: Navigate to the database category and click PHPMyAdmin.
  2. Choose your newly created database from the left-hand side of the page. 
  3. Along the top of the screen, click the Import tab. 
  4. Click the Browse button, and locate the file on your computer.
  5. Once you select the file, click Go to start the import.

Update your WordPress Configuration File

Now you need to make sure that your WordPress install is connected to the correct database. To do this,

  1. Open your File Manager and edit the wp-config.php file. 
  2. You will need to type in the new database information: database name, database user, and password. 
  3. Once you have updated those, click Save Changes.

Fixing your Permalinks

  1. Log into your WordPress Dashboard using the username and password from the copy of WordPress you brought over.
  2. Under Settings, click Permalinks. 
  3. You don't have to make any actual changes; click the Save Changes button.

Doing this will update all the pages and post URLs. If you have custom themes or plugins/widgets with old URLs, you will have to update those manually since no plugins can modify them.

View your Site

Once you have completed these steps, view your browser's site to ensure everything looks correct and is functioning correctly.