Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Move WordPress From Local Server to Live Site

Last updated on by
Follow WPBeginner on YouTube
How to Move WordPress From Local Server to Live Site

Developing a WordPress site locally can help speed up the development process. In the past, we showed you how to install WordPress on your Windows computer using WAMP and on Mac using MAMP. Once you have finished the development on localhost, the next step is to move the site live. In this article, we will show you how to move WordPress from local server to a live site. By using this process, you would be able to migrate all of your content (posts, pages, images, etc), themes, as well as plugins from local server to a production site.

Before we start, we must let you know that you can make this migration from local server to a live site easier by using one of the two plugins: BackupBuddy or Duplicator. In this article, we will show you how to move WordPress from local server to live site manually, so you can learn the process. However to make the process easy for us, we rely on BackupBuddy when we do this on a day to day basis.

Pre-Steps

In order for you to migrate your locally developed WordPress site to a live server, you need to have two things. First is the local server. We are assuming that you have a WordPress site running on local server, and you have full access to it. Next, you would need to have web hosting that supports WordPress, so you can migrate your content over.

You would need to have a FTP program and know how to use FTP, so you can upload your content to the live site.

Note: the screenshots used in this article are from WordPress hosting providers that have cPanel.

Step 1: Export Local WordPress Database

First thing you need to do is export your local WordPress database. We will be using phpMyAdmin to do that. If you are unfamiliar with it, then you might want to take a look at our guide to WordPress database management using phpMyAdmin. Simply go to http://localhost/phpmyadmin/ and click on your WordPress database. Next, click on the Export button from the top menu bar.

Exporting WordPress database using phpMyAdmin

In the Export Method option choose custom, which will provide you with more options to export your database. Select all tables to export and gzipped for compression. Scroll down to the bottom of the page and press the Go button to download your database.

Step 2: Uploading WordPress Files to Live Site

Now open an FTP client and connect to your live site. Once you are connected to your live site, make sure you upload the files in the right directory. For example if you want the site to be hosted on yoursite.com, then you would want to upload all files in your public_html directory.

Now select your local WordPress files and upload them to your live server.

Uploading WordPress from localhost to live site

Step 3: Creating MySQL Database on Live Site

While your FTP client is uploading your WordPress files, you can spend this time on importing your database to the live server. Most WordPress hosting providers offer cPanel to manage your hosting account, so we will show you how to create a database using cPanel. Log in to your cPanel dashboard and click on the MySQL databases icon which can be found in the databases section.

Creating MySQL database in cPanel

On the next screen, create a database by entering a name for your database.

Create a new database

After creating a database, scroll down to MySQL users section and create or add an existing user to the database. After adding the user, cPanel will take you to set MySQL privileges for that user. Simply grant all privileges to the user.

Create a new MySQL user or Add an existing user to the Database

Step 4: Importing WordPress Database on Live Site

Next step in the process is to import your WordPress database. Go to your cPanel dashboard, scroll down to the databases section and click on phpMyAdmin. This will take you to phpMyAdmin where you want to click on the database you created earlier. phpMyAdmin will show your new database with no tables. Click on the Import tab in the top menu. On the import page, click on choose file button and then select the gzipped database file you saved in step 1. Lastly, press the Go button at the bottom of the page. phpMyadmin will now import your WordPress database.

Importing database in phpMyAdmin

Step 5: Changing the Site URL

Now you need to change the site URL, so you can setup your live WordPress site. In your phpMyAdmin, look for the wp_options table in your database that we just imported in step 4. If you changed your database prefix, then instead of wp_options it might be {prefix}_options.

Click on the browse button next to wp_options or the link that you see in the sidebar to open the page with a list of fields within the wp_options table. See screenshot below:

Browse wp_options in phpMyAdmin

Under the field options_name, you need to look for siteurl. Click the Edit Field icon which can be found at the far left at the beginning of the row.

Edit siteurl in phpMyAdmin

When you click the edit field, an edit field window will appear. In the input box for option_value, you will see the URL of your local install probably something like: http://localhost/test. Carefully insert your new site url in this field, for example: http://www.wpbeginner.com

Save the field by clicking the Go button.

Next, you need to replicate this step for the option name: home. The wp_options page can be a few pages long, so simply find the home tab. Usually it is on the second page which you can navigate to by clicking on the pagination arrows in phpMyAdmin.

Update the home url to be the same as your siteurl.

Step 6: Setting Up your Live Site

Now that we have imported the database, and all of our content should be uploaded, it is time to configure WordPress. At this time, your site should be showing an Error Establishing Database Connection error. To fix this, connect to your website using an FTP client and edit wp-config.php file. Provide the database name, user and password you created earlier in Step 3. Save the wp-config.php file and upload it back to your server. Visit your website, and it should be live now.

Login to your WordPress admin panel, and go to Settings » General. Click save Options. This will ensure that the site url is corrected anywhere else that needs to be.

Then go to Settings » Permalink and click Save to ensure that all post links are working fine.

Step 7: Fixing Images and Broken Links by updating Paths

Whenever you are moving a WordPress site from one domain to another, or from local server to a live site, you would face broken links and missing images issue. You can either use the SQL query or use the Velvet Blues WordPress plugin.

For those who want to do it via SQL, here is a simple SQL query that should solve this problem:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/', 'www.yourlivesite.com/');

Simply go to phpMyAdmin, click on your database and then click on SQL from top menu. Write this query but don’t forget to change it with your own local site and live site URLs.

Fixing WordPress images and broken URLs after moving to live site

That’s all, hopefully your live site will be up and running by now. Checkout your site to make sure that every thing is working fine as expected. For troubleshooting and questions feel free to leave us a comment below and we will try to help out as much as we can.

If you are doing this on a regular basis, then we highly recommend that you get BackupBuddy because it will make your life easy. You will thank us for that later :)


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. darrync says:

    hmm, not working for me.
    I went through and did this first time and had problems with php.errors.

    So I tried a 2nd time and then i finally got the the ‘Error Establishing Database Connection error’

    Then progressed until yes i saw my live site.
    However when i click on the login to WP admin on the now live site, it takes me to a directory of wp-admin and the whole WP GUI is not shown!

    This leads to me think there was an WP install problem…or..?

    Note I am a newbie to WP, PHP, CSS, so please explain as if to talk to a 5yo child please :DDDD

    thanks

    • WPBeginner Support says:

      You need to update WordPress urls. If you can use the admin area then go to Settings > General and make sure you have the URL of your live site in both fields.

  2. obai and hill says:

    I am following the steps and they are very clear and works well every time.
    However, this time i followed the steps and when i reached to step 6 where i will have to set up the WP account, the website worked without giving me the error establishing database connection message.
    The problem is i can access the new website wp-admin and the pages redirect me to the testing domain. please help

  3. Dave says:

    Thanks for the article. Very helpful!

    I have a question. My current live site (fatcow hosting) is running on a very old version of wordpress. My new local site is ready with the latest of everything. I wanted to create a subdomain and test this new site live on different devises and browsers before actually taking it live.

    My question is can I have 2 versions of wordpress running on my hosting site? Will ask the host too, but thought I would ask here as well. So the idea is have my current site which is outdated running while I beta test my new site. Once the new site is all good, then I will replace the old with the current. Good idea? Silly naive thinking from a beginner?

    Thanks for any help!

    -Dave

  4. Bhaumik Dhandhukia says:

    Thank you very much. My site is live and running.

  5. Shaheryar says:

    Thank you!!!!!!!!!!! Life saver article.

    Helped me a lot!!!!!!!!! I did everything step by step. Had to change database names accordingly, had to fix broken links manually but hey, its just small stuff to change which I fixed it quickly.

    Really appreciate your time and effort to create such a userful site.

    Thanks.

  6. cyberwaver says:

    I did everything mentioned here. Mine is am transferring from one host to another host I followed every step here but my website is still showing blank.
    check any help will be appreciated.

  7. Wellbein says:

    Hello . I tried all the process and it seems lie I’m the only one here who s a problem. The problem is the white screen. I can’t troubleshoot because the screen is blank. OMG. I am very sure that I followed the instructions when in fact it isn’t my 1st time to migrate a local site to the live site. What does the white screen means? Please help!! :(

  8. Don_Kihot says:

    I have developed child theme locally, what are the steps to upload to live server?

  9. george says:

    thanks for d dis update, my site uploaded well but d pages are not opening fulling, d post and home page open well but the page just open half well. pls help me

  10. olenyash says:

    Best guide i have been through so far — on everything. Thank you a tonne

  11. Dale Powell says:

    This article has saved my life since the day it was published. Can’t thank you enough

  12. Osama says:

    Great Work !

    This Transfer Method Works Good Work

    Thank You

  13. Ben says:

    Excellent article. I’ve just followed it step by step for my new business website I’ve been developing on WAMP.

    Keep up the great work!

    Ben.

  14. Rudra says:

    Really great thanks man

  15. Juan C says:

    THANKS MAN!!!!!

  16. Matthew Eaton says:

    At step 5, I cannot alter the site url or home. It won’t give me the option of editing.
    What went wrong?

  17. Adam says:

    When I import all files and database I have error 500 on subpages… Why??

  18. anthony says:

    when I import my database not all of the tables are there. I’m wondering what I’m doing wrong….

    • Jay Doshi says:

      Firstly You have to select your database(Click on your create database name) and then import your .sql file.

  19. Kailashkumar says:

    Sir i want to upload WordPress site form local host to live server.

  20. Robin says:

    One tip maybe I can help someone with this.
    My database from my localserver was far too big to import due to the import limit.
    I have used the 7ZIP program to zip my exported database to a gzip file.
    This has solved the problem for me.

    Thanks for the article! At the moment my website is uploading…

  21. Thijs says:

    Thank you very much for the tutorial. I regret to say that after step 5 everything went blank.
    The site is gone and I am not able to recover the information.
    I can not believe that creating a simple site can be so difficult.

  22. Robin says:

    Thanks for the info.

    Tomorrow I am going to replace my wordpress website. I am reading some people are having issues with the thaccess file. Do I have to change the site adress in this file or not?

    Thanks!

  23. Claudio says:

    This was certainly a very helpful tutorial, but why go through such a lengthy process when you can just export and import everything? There might be a couple of things missing like the media library but that’s really easy to download and upload.
    I’ve been creating child themes for a while and this what i do for my clients:
    – create the whole child theme abs site offline
    -once finished simply select expert everything from the settings
    -install WordPress on the line host
    -select import and point it to the xml file produced before
    -that’s it! All your post and pages should be there now
    – simply install the cold theme you’ve created and tweak what ever looks “funny”.
    I hope this helps.

  24. Aurang Zeb Khan says:

    I am trying since 2 days, “i spend almost full day” but could not succeed. I wanted to try a simple website with only one post so that i could get to know how the whole process will go when i complete my site in the wordpress.
    I have done all the steps successfully but when i try to import database to the hosting website an error occurs and i dont know how to solve this. i am using SmartFTP. can anybody help?

  25. Alex Evans says:

    Hi, I understand this process, but can anyone send me a link or tell me the process for taking a locally hosted WP site and uploading it to go live, where there already exists a site on the domain?

    For example if I’m creating a new site for someone and now I need the locally hosted site to appear for said domain instead of the hold one.

    I’m confused on how DNS works

  26. Raja Asad says:

    Hi ,
    please anyone help me out
    actually i did all these steps that mentioned above but still couldn’t upload my site form local host to live server
    what else i do ?

  27. Asad says:

    Hi ,
    i did these all steps but yet i am able to transfer my site from local to c panel
    please suggest one thing more is there already word press install on c panel or we have to install it there ?

  28. PAUL says:

    Hi

    Thanks for an excellent article – clear, concise, well-illustrated and easy to follow. I’ve been uisng Duplicator for ages, but it just decided – this time – that it wasn’t going to play fair!

    Everything worked perfectly until Step 7. The SQL query fixed some, but not all, path changes. I then resorted to the Velvet Blues plugin, which fixed all but one path. I’m still struggling to find a solution for the following:

    I have a plugin which utilises its own (two) stylesheets. While Velvet Blues has changed the path to one stylesheet, the other doesn’t want to change. Any ideas how I can effect this manually?

    Thanks and regards
    Paul (“Webbo”)

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.