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. Mark says:

    Hi, I don’t know if anyone suffered from a redirect to their local host when they ran wp-admin. I did but I found a post over at stackoverflow that sorted me out. Basically I had to update the filepaths in the WP-Options table.

    Good luck.


  2. Mujtaba Zia says:

    *** This is the best ever tutorial of my life ***
    I know about html/css but never worked on wordpress, this tutorial helps me lot and have my site live by following every step and wordings of it. Thank you so so much!

    Now very eager to learn more through this website.

  3. Kathy says:

    I’m encountering some serious problems when transferring to live server. Locally I have 2 sites using the same theme. Both running off separate databases and sites, both work perfectly locally. One site is uploaded and running fine and i’m in the process of uploading the second, here’s where it goes wrong. I’ve exported and created the database, working perfectly all images appear correct. I uploaded all the files and amended the config then ran in to problems. I appear to have no content loading and only half a theme along with the incorrect logo of the site. I tried to login in to amend all links but i am returning an ‘internal server error’ the sever encountered internal error or misconfiguration and was unable to complete your request.

    I have rolled the site back to it’s previous look but i am at a complete loss as to next steps, can anyone help? I can not understand how we are working perfectly locally and then an epic fail on live.

  4. DaveJorg says:

    Heads up that sometimes after the migration is complete only the home page works.

    If this is the case visit Dashboard > settings > pemalinks and click save changes. I believe it updates the mod_rewrite and should fix the issue. It did for me.

  5. RW says:

    Please remove my email from the comments thread. I’ve tried to unsubscribe each time and it’s not working.

  6. Carlo says:

    Thanks for this guide. I’m a more than a beginner in this field. How can I proceed if I have a database already installed on my hosting. Do I have to delete it and make new one, cancel the tables or simply empty them? Thanks in advance for your help

  7. Nathan says:

    I moved everything and it went smooth until I tried logging in to WP it keeps saying password incorrect. I even tried changing details in phpMyAdmin. Could the problem be that I ran your query before logging in to WP?

    • Nathan says:

      I fixed the problem, i just signed in to WP and re-saved permalinks and whole site was update. Thanks for the great tutorial.

  8. Angela says:

    Unfortunately, I wasn’t able to move my site from localhost to online. I got to the login page and it wouldn’t accept my login information. Any idea what the problem could be? I don’t want to give up on it so I may try again.

    • Omar Zeidan says:

      Hi Angela,

      Well, you might forgot to import the DB files to your live server, did you ?

      If nothing worked with you then try the following,

      Access your DB admin panel, find the wp_users and manually add one there.

      Hope this helps.

  9. Pranesh says:

    Excellent guide. Everything went fine. Thanks a lot !!

  10. Ziga says:

    Hello, i followed all steps, and at step #4, i choose .gzip file to import, and got the following error:

    #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

    Any help?

  11. Justin says:

    Everything works except my other pages…. Can’t figure it out

    • Matt says:

      Similar issue for me. Have added it to a subfolder on another one of my domains, but when I navigate to it, I’m shown the Themes 404 page. When I try to go directly to any of the other pages, I get my hosts 404 page. Any ideas anyone?

  12. Ryan says:

    I’ve gone through all the steps, and my site ends up not looking at all like it did. It appears most of the CSS didn’t transfer over. I was using the Divi theme.

    Here is what it looks like:

    Any tips?

  13. Amefon says:


    i got this error while trying to import my database onto the site

    SQL query:

    — Database: `lcmi`


    MySQL said: Documentation

    #1044 – Access denied for user ‘lazarbwn’@’localhost’ to database ‘lcmi’

    how do i solve this?

  14. Mike Casile says:

    Have not done this yet, but local site is looking good. I do have 2 questions (which may really be too big and may require follow-on articles).

    1. If I go thru this and it comes out nice on the live site … but I want to continue doing new development locally, is there a similar process for incremental changes?

    2. How will this be impacted if I use multiSite (which I’m NOT doing right now).


    • Roman says:

      It depends on what your changes are affecting – if you have changed some css or php code in theme, you will need tu push changed files on server using FTP. If you change some wordpress settings, you only need to go through steps of copying your database.

  15. Ameira says:

    Thank you for this tutorial – after 2 weeks of trying everything under the sun finally found out what was missing. I have been able to access my website but images are missing and the layout is all over the place. I followed step 7 and it did improve the improve slightly but still quite a mess – any ideas on what else I can do?

  16. Soo says:

    Easy to understand and follow.
    The best tutorial about”How to Move WordPress From Local Server to Live Site”.

    Thank you

  17. zavera says:

    Hi WPBEGINNER SUPPORT, i have created custom wordpress site with some pages and used all the steps you mentioned here and all worked correctly but my pages urls are still localhost how to change these urls for pages?

    • WPBeginner Support says:

      If you can access the admin area then go to settings -> General and change your WordPress URL and Site URL. Or look at the step 5 to do that through phpmyadmin.

  18. Daniel Afriyie Gyimah says:

    ples we need the information in a downloadable PDF format

  19. Andres says:

    Hello ! I tried using this method and I get the following error:

    lessphp fatal error: load error: failed to find /Applications/MAMP/htdocs/breg/wp-content/themes/theme43776/bootstrap/less/bootstrap.lesslessphp fatal error: load error: failed to find /Applications/MAMP/htdocs/breg/wp-content/themes/theme43776/style.less
    Warning: Cannot modify header information – headers already sent by (output started at /home/weliketo5/public_html/breg/wp-content/themes/CherryFramework/includes/less-compile.php:155) in /home/weliketo5/public_html/breg/wp-includes/pluggable.php on line 1207

    Could anybody help me out?

  20. Alfredo Garcia says:

    While doing step #4: Import WordPress Database on Live Site, I get the following SQL error:

    MySQL said: Documentation

    #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 105

    Can you tell me what is wrong and how I can fix this?

    • WPBeginner Support says:

      The backup file you are trying to import could be corrupt. Export a fresh copy and then try again. If this does not work, then ask your web hosting provider to update your MySQL version.

  21. Ngabe R says:

    I was missing step 5. Thanks a lot. Very helpful!

  22. Adam says:

    Do I need to install WordPress on my server before beginning this process, or do I just follow the steps as listed?

    • WPBeginner Support says:

      No, please see step 2. You will upload WordPress files from your local server to the live server.

  23. Rod says:

    Thanks, very helpful ! Once I worked out the correct server name on the host et all went well.

  24. Yonatan says:

    Great article and really helpful.

  25. Momodu Oladapo Abraham says:

    it worked thanks, however there arre still some links connecting to the local server address most experienced on the posts and blogs…what do i do ..please help…every other thing has worked fine except the posts. Thanks

  26. Natharza says:


    Everything worked out but the post links are not working. I do run the sql query still links were broken with the error “No input file specified.”

    Please help

  27. Michael says:

    Thanks for this article. It saves me from stress of redesign online

  28. Sarah says:

    Thanks for a great tutorial, followed every steps and nothing went wrong !
    THUMBS UP +++

  29. Fongoh Tayong says:

    Man, you are the bomb.

    It worked for me like charm.

    More power to you to write more tutorials on this. I am newbee to wordpress.

    Thanks again.

  30. Louise says:


    With step 2, if you dont have a public_html directory where else can you upload the file under? as per Milos question. I have gone into file manager and to httpdocs file and uploaded it there.

  31. Max says:

    Thank you for a really simple, easy to follow tutorial on how to migrate a database. I notice that you didnt’ state to update the DB_HOST name, but otherwise this was great.

  32. Stefano says:

    Hi! First of all thnx for the detailed guide.
    I followed all the steps without problem. Anyways, the theme and all the plugins i had installed on localhost are missing causing the page looking completely different. What can i do to import all previous plug-in and settings? Thank you in advance for toyr reply

  33. Junn says:

    Hi thank you for this tutorial, It works for me! However, I cant find the pages I created locally and settings are not right. It did let me install a new wordpress.
    What went wrong?

  34. Monique says:

    hello. thanks for this tutorial. but i have a problem at step 6. All first 5 steps are done. but when i reload my site after changing URL in database. there is no such message as “Error Establishing Database Connection error” and my site is still opening in local host. please help what i should do now

  35. Alex says:

    How to create MySql db on my actual site. My provider can help me?

  36. Miloš says:

    Hi, it is me again. Now I have a problem with step seven. I put that code with my own web page
    in my sql but 2 of five pages still don’t work. I propably didn’t understand your instructions very well. What do you mean by ”but don’t forget to change it with your own local site and live site URLs. ”?

    • Nadeem says:

      could you please check your menu under the appearance and then click one by one those menu which is not working properly. hopefully you’ll find the errors.

  37. Nikhil says:


    Thanks for the help…

    All the steps are working perfect….

    But When I am trying to login or Click on Any link….

    It show me following msg….

    My Website :
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at webmaster@ to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    What’s the solution of this error…

    • Dwayne Smith says:

      Hi NIKHIL I am having the same problem did you manage to figure out what the problem was. If so could you please let me know your solution


  38. Mustapha says:

    Very helpful post
    thank you

  39. Milos says:

    I have a problem with step 6 since that I don’t know how to edit wp-config.php. The thing is that when I click right mouse and open view/edit there are no options for entering database name, user and password.
    Also in step 3 I uploaded my WP files in htdocs file because that’s the only folder that I see. I use FileZilla.
    I would appreciate very much if you could answer me on my email.
    Miloš B.

    • Andrej says:

      Milose… When you open wp-config.php file, you need to open it as a notepad document, and find at the beggining of the text database name, user and password, edit text manually and then save again.

  40. Matt says:

    I ran into an sql error 1064 when importing using a compressed export. Finally got it working by exporting as an uncompressed .sql

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.