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. Croiche Jim says:

    thanks a lot :)


  2. Sneha says:


    I have created my website on my local server and also I have used action method to navigate to different pages. But on these action methods I have given localhost permalinks only as destination address. So do I have to replace it with live address everywhere in the code or is there some method by which i can replace it at once.

  3. Chris Cal says:

    I’m not one to usually comment but this is an excellent post.
    Great work Syed and team. Greatly appreciated.
    Cheers, Chris.

  4. Leslie says:

    It was the .htaccess file!!! But I had to upload a completely new file. Thanks!!!

  5. Courtney says:

    Any tutorials for when you have forgotten your phpMyAdmin login info? I am stuck at the beginning! It has been a while since I have needed to login and cannot for the life of me remember. I used this site as a tutorial to set up but cannot figure out how to reset. I have seen some tutorials to reset but I am afraid it is going to mess things up as I am not an expert. Any suggestions or tutorials you can point me to? TIA

  6. Tyane says:

    I’m stuck on step 6. I edited the wp-config. file and uploaded it. It gave me six errors, with most of them beginning with, ” unexpected beginning of statement” followed by the position each error is listed. I’m very new to this and my IT husband is out of town till Friday.

  7. barshan hassan says:

    Thanks… I love u

  8. leon says:

    works really well!

  9. geeuy says:

    great tutorial!
    worked like a charm!

  10. ashkan says:

    hi there tnx for this article

    i did all these steps and my site is up now but when i click on other pages or links i faced this eror
    (Internal Server Error)

    in fact I just can see the homepage

    can You tell me about This?

    • Thatguy91 says:

      I had the same issue, go to the permalinks page and click the save button. I think it needs to “resave” the permalinks again somewhere once migrated.

  11. mtahirian says:

    I have uploaded my site live. but unfortunately i can’t go to wordpress admin. the wordpress admin is working fine on local server. it has problem keep telling that : Warning: Cannot modify header information – headers already sent by (output started at /home/………/public_html/wp-content/plugins/js_composer_theme/js_composer.php:1) in /home/porseshresearch/public_html/wp-includes/pluggable.php on line 1228

    Please Help

    • WPBeginner Support says:

      Seems that js_composer_theme plugin is not working. Connect to your website using FTP and then download the plugin to your computer. After that you can delete the plugin from your server. This should resolve the issue.

      • mtahirian says:

        Thanks for responding.
        I did, as told. but the whole site is smashed up and can’t get the design correct. I need the COMPOSER.

  12. wpbeginner says:

    Thank you very much for your wonderful tutorial.
    I am having a problem where my website is only accessible through but not accessible through
    May I know what can be done to solve this?

    • WPBeginner Support says:

      Your blog is hosted as a subdomain. You will need to export it to your main domain.

      • wpbeginner says:

        My subdomain folder is in public_html folder.
        May I know where should I export it for it to be in my main domain?
        Your help is greatly appreciated.

  13. awoyemi ayomide says:

    thanks it help me a lot

  14. Lars Breum Hansen says:

    I am stuck at step 6. My site is live, but instead of going to my main page, It show my themes default main page, at gives me an 404 (because it can’t find posts, but my main page is set to be static). And I can’t login as admin, becuase then it gives me the 500 internal error?

  15. Kim Macc says:


    This article is great thank you!! I have done everything and the site is live but the pages are not linking/working i get an ‘internal server error’

    please help me fix this as soon as possible. have done the SQL query but to no avail.

  16. AP says:

    Make sure hidden files are copied over as well as part of Step 2

  17. Ebune says:

    i had a problem in the step where i am to change localhost/test. to my site name. i cant really see an edit but to change that stuff. also, when i try to upload my database, it gives me an error. please can anyone help??? am in a deep shit right now

  18. Mayur says:

    My website is
    I have changed my server , i took backup of wp files and mysql before my server service expired. Now i am on a new server, uploaded and extracted wp files in public_html, i am. Getting an error – error establishing database connection, hoe should i solve this error?

  19. Caitlin says:

    Hi! I ran into a problem in step 6: “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.”

    I did that and it didn’t work, so I started to edit where it said “localhost” and changed it to my domain.

    I’m a totally newbie so any help would be appreciated!

    • WPBeginner Support says:

      Try using localhost as your MySQL Host

      define( ‘DB_HOST’, ‘localhost’ );

  20. ananta says:

    owh… maan… this is what i am looking for all day long… finally found your article. it’s very helpful. now, my site is live. thank you. good work by the way.

  21. Raj jain says:


    How can I solve this error. Reply urgently.

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /home/sitename/public_html/wp-includes/pomo/mo.php on line 236

  22. Elise says:

    Hello, I’ve been following all these steps but when I’m doing the export but when I’m importing in my OVH database I can only see wp_commentmeta and wp_comments instead I’ve selected all tab during the export and choose custom and the gzipped format
    Do you know what’s happening here?

  23. Amey mankar says:

    Thank You so much. It help me alot.

  24. Mboule A says:

    I tried changing localhost to my domain name but it isn’t going. I need help. I’ve tried both methods. Both the plugins and using the SQL code

  25. Bessong william says:

    thanks you for you tutorial, but am still a beginner in web developping, i need you to teach me with a plugin like BackupBuddy or Duplicator or what ever!!!, how to migrate my website from local to live production site

  26. cmunozro says:

    Can’t access my website.
    Error al establecer una conexión con la base de datos (unable to connect to data base)

    I try accessing thorough the IP as the domain is not transfered yet. I’m not sure in the wp_options and in wp_config what data should I use.

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.