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

How to Move WordPress From Local Server to Live Site

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
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.


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, 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:

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/', '');

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 »


  1. justin says:

    Okay everything was sailing smooth until I went to import the new database. Upon trying to import it it only puts in wp_commentmeta, wp_comments, wp_links, wp_options and then spits out the error code: ” #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘?’ at line 2 “. Now the whole site is down and I don’t have a clue what the heck it is referring too when it says “line 2”. Line 2 of what? And of course the Manual is so friggin helpful man I’ve never seen such helpful stuff (is there a way to type sarcastically?) Please help…

  2. Frosty says:

    Thanks mate. You are a diamond! Ran into a few problems, mainly 123 reg php address was incorrect but got there in the end.

    Many many thanks

  3. kathy says:

    Hi, I am trying to import the database but appear to be getting an error. Any ideas anyone? I’m new to wordpress land.

    • WPBeginner Support says:

      Can you please only paste the error line?

      • kathy says:

        I’ve exported my local database and tried to import and it’s returning the below.

        Database: `root_wordpress-trunk`
        Table structure for table `wp_comments`

        #1046 – No database selected

        Any help would be greatly appreciated.

  4. Rob says:


    I have migrated my site from local to host server. I followed all steps and everything went right but finnaly, I am missing content (posts, pages etc.). Does anybody has any advice?

  5. Yosifov says:

    Hallo, all worked nice so far, but I reached the step 5 where phpmyAdmin is not giving me the option to edit siteurl and home..

  6. amin says:

    thanks for this tutorial ,
    I follow this steps and it work correctly i have domain and hosting from godaddy.

  7. Adeel Ashraf says:

    really awsome work (Y)

  8. kanav says:

    do i need to copy all of my data on a live server with preinstalled wordpress ?

    like godaddys managed wordpress ?

  9. Claire says:

    I have followed all of the steps above, and everything has gone correctly up until the very last part.
    I have edited and uploaded the wp-config.php file and now my webpage is just a blank screen and I have not been able to get into edit it in wordpress. I thought I had lost the whole thing…. I changed the urls in php.myadmin back to local/wordpress and can access it again.

    What is going wrong please? Any help appreciated!

    Thanks, Claire

    • WPBeginner Support says:

      Undo the changes you made to wp-config.php you have probably missed something when editing it.

      • Katy says:

        Ok I’m having the same problem and I’ve uploaded and reuploaded and changed the wp-config.php file. If I deliberately put in something incorrect it shows error establishing database connection. When I put in the correct information I just get a blank page. Blank page for /wp-admin as well.

  10. Michelle Whittaker says:

    Thank you so much! This was exactly the step-by-step resource I needed! I did get a dB error trying to import the gzipped file but I went back and exported the dB as a zip file and imported into new dB and that worked fine.

  11. Chris Jacobsz says:


    Thank you for the excellent article. I am a novice and struggled with Duplicator but got my website up and running by following these instructions step by step. Only one thing, my SQL query to update the broken image links did not work. So I had to do it manually.

    Thanks very much.


  12. Mike says:

    Excellent article!!!

    One thing to note: Please be sure you know the SQL host server name before you begin! It took me a little while to figure out that “localhost” in the wp-config.php file needed to be changed to the name of my hosting server.

    Everything in the article is spot on and saved me hours of moving my Dev site to my hosted provider….

    • Arjun says:

      Mike, I am using godaddy and how do I find out my SQL host server name? Currently leaving it as ‘localhost’ in wp-config.php file is not helping. Any help appreciated. Been trying but with no luck.

  13. Maggie Walker says:

    Thank you SO SO SO much for this article!!! I am setting up a WP site for a friend for the first time and it was SO helpful to have this article to walk me through the process of going from local to live! I’m a Front End Dev so the help with all of the PHP, SQL, and FTP was incredibly useful.

  14. 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


    • 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.

  15. 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

  16. 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!


  17. Bhaumik Dhandhukia says:

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

  18. 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.


  19. 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.

  20. 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!! :(

  21. Don_Kihot says:

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

  22. 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

  23. olenyash says:

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

  24. Dale Powell says:

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

  25. Osama says:

    Great Work !

    This Transfer Method Works Good Work

    Thank You

  26. 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!


  27. Rudra says:

    Really great thanks man

  28. Juan C says:

    THANKS MAN!!!!!

  29. 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?

  30. Adam says:

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

  31. 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.

  32. Kailashkumar says:

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

  33. 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…

  34. 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.

  35. 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?


  36. 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.

  37. 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?

  38. 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

  39. 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 ?

  40. 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 ?

  41. PAUL says:


    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.