How to Transfer Local WordPress sites to a Live Server

This is a step by step guide on how to transfer local WordPress sites to a live server. The server I am using in this article has a cPanel backend. This guide follows on from my article on how to install WordPress locally using MAMP

Step 1: Check that you have the following in place

1 – A local WordPress installation (please see my previous guide on setting this up).
2 – A remote hosting package including domain name.
3 – An FTP program such as FileZilla.

Step 2: Export the Database from your local WordPress installation

Go to phpMyAdmin via your browser using the following path:


Click the Export tab, as shown in the image below:


Leave the options as default (Quick export) and click Go then save the exported file.


Step 3: Transfer local WordPress files to live server

The next step is to upload all of your WordPress files to the remote sever. There are a couple of options here, you can upload all of the individual files to the remote installation folder via FTP, or (using cPanel) you can zip all of the files together as one archive, upload them and extract them directly on the server (this method is much faster).

Just be certain that you are uploading everything to the correct directory – e.g. if you are are aiming for the root of your domain, the path will be:


Options to transfer local WordPress installation: 

Option 1 / FTP – Upload directory contents as individual files and folders to your installation directory on your live server:

transfer local wordpress files to live server

Option 2 / cPanel – Compress files and folders locally as a single zip file, then upload to installation directory on live server, right click and extract the zip directly on the live server:


Step 4: Create a new MySQL Database on remote server

Whilst everything is uploading, you can now import your database into the live version of the site.

First we need to create a new database that we will use later to receive the imported data. As mentioned earlier, I am using cPanel for this guide.

Open the cPanel dashboard and head to MySQL Databases as follows:


Then go to Create New Database, enter a short descriptive name and hit Create Database.


We will now add a new user to the database.

Go to Add New User, fill out the username and password, then hit Create User.

Then go to Add User to Database, and in the User drop-down menu, highlight the user you just created, then select the Database drop-down and highlight the name of the database you just created. Hit the Add button.


Set privileges for new user as follows:


Step 5: Import WordPress Database on Live Site

Now we can import the database. In cPanel, go to phpMyAdmin:


Click on the database you created earlier (step 4).

At this point you will see that the database has no tables.

Select the Import tab, then hit Choose File and upload the database file you exported earlier (in step 2) from your local WordPress installation.

Hit Go to import the file.

import database

Step 6: Update the Site URL in 2 places

To allow the database to connect to the WordPress site that we uploaded earlier, we must update the site url. Currently it will be pointing to localhost, and we must change this to point to the domain name on the live server.

Whilst still in phpMyAdmin, locate the wp_options table we imported in the previous step. Select it.

Then, hit the Browse tab, and you will be presented with a list of fields in the right hand pane.

The ‘siteurl’ option_name should be edited first (click Edit as indicated by the top arrow in the right hand pane of the image below):


In the edit window (where the arrow is pointing upward in the image below), change the current url from http://localhost to your hosted domain name e.g.

Hit Go to save it. Repeat this step with the option_name ‘home’.


Step 7: Open the site in your browser

If you now access the site in your browser you will see the following message:

Error Establishing Database Connection

We can fix this by doing the following:

Go to the root of your WordPress installation on the live server, and download the file wp-config.php. Add the database name, user and password (you created these in step 4) then save the file and upload, overwriting the previous version.

When you access your site now, it should be working.

Step 8: WordPress Admin Panel

In order to make sure that the site URL is updated everywhere else, and that all post links will work as they should, we must do the following.

In WordPress dashboard, go to Settings / General, scroll right down and hit Save Changes.

Then, go to Settings / Permalinks and hit Save Changes there also.

Congratulations, you just migrated your local WordPress site to your live server.

The final step is to check that there are no broken links on the site.

Step 9: Update paths to fix broken links or images

You can update paths to fix such errors using an SQL query. Before performing this step, please make sure you are confident about what paths you want to search for and replace here. Generally you will be replacing localhost with your domain path, but you should double check everything before running a query.

Go to phpMyAdmin, click on your database and then click on the SQL tab.

Input the following query (update it with your own site details first).

UPDATE wp_posts SET post_content = REPLACE(post_content, ‘localhost/’, ‘’)


Other posts
  • Blue Hotel Illustration
    Blue hotel (2D illustration) I haven’t posted in a long time. I set up this blog with the intention of updating it regularly, however it has not worked out
  • An article on thin line display issues when PDFs are viewed in AcrobatAn article on thin line display issues when PDFs are viewed in Acrobat
    Do your PDF Line weights look wrong in Acrobat? A simple solution to Acrobat’s ‘enhance thin lines’ feature. Adobe Acrobat will sometimes add
  • Heatwave Illustration
    Heatwave (2D illustration) This is an illustration project I have been working on with reference to the recent weather in the UK. In this isometric piece I present
  • Illustration (Urban Theme)
    Spirit of the Staircase (2D illustration) This is a section of a larger illustration I am working on. It is part of a series of 2D vector illustrations which I hope
  • Install Sass on macOS
    This is a simple short guide on how to install Sass on your Mac. If you receive an error whilst installing Sass, this article should provide a quick and simple solution. At the time of writing I am using macOS Sierra 10.12.5.