Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Move WordPress From Local Server to Live Site (2 Methods)

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Many WordPress users prefer to work on their websites using a local server on their computer before transferring it to a live hosting server.

It allows you to work on your website privately before making those changes available online.

Eventually, you’ll need to move it to a live server to make it available for online visitors.

In this article, we will show you step-by-step instructions on how to move WordPress from a local server to a live site.

How to move WordPress from local server to live site (2 methods)

Why Move WordPress From a Local Server to a Live Site?

Building your WordPress blog on a local server is a safe way to test changes on your website without affecting visitors.

When you have finished perfecting your website, the next step is to move from your local server to a live site.

Let’s show you two ways to move your site from a local server to a live site.

The first method uses a WordPress migration plugin and is recommended for beginners.

In the second method, we will show you how to manually move WordPress from a local server to a live site.

You can choose the method that works best for you:

Before You Migrate Your WordPress Site

To migrate WordPress from a local server to a live server, you need to have a few things in place.

First, we are assuming that you have a WordPress site running on a local server (also called localhost) on your computer and you have full access to it.

Next, you’ll need to have a domain name and web hosting.

To make your decision easier, we recommend using Bluehost. They are an officially recommended WordPress hosting company, and they are giving WPBeginner users an exclusive discount + free domain and SSL.

Basically, you can get started for as little as $1.99 per month.

If you want a great Bluehost alternative, you can look at Hostinger. They are also offering an exclusive discount to WPBeginner users with a free domain name.

If you can afford to pay a little more, then check out SiteGround. They also have a special deal for WPBeginner readers.

If you need help setting up your website, then follow our step-by-step guide on how to make a website.

Finally, you will need an FTP program and know how to use FTP to upload your local server site to the live site.

Ready? Let’s begin migrating your WordPress site.

Video Tutorial

Subscribe to WPBeginner

If you’d prefer written instructions, then just keep reading.

Method 1: Transfer WordPress From The Local Server to Live Site Using a Migration Plugin (Recommended)

This method is easier and recommended for beginners. We will be using a WordPress migration plugin to move WordPress from localhost to a live site.

Step 1: Install and Set Up the Duplicator Plugin

First, you need to install and activate the Duplicator plugin on your local site. For more details, see our step-by-step guide on how to install a WordPress plugin.

Pro Tip: There is also a pro version of Duplicator that offers secure backups, cloud storage, easy site restore, and more.

Upon activation, you need to go to the Duplicator » Packages page and click on the ‘Create New’ button.

Create new package for migration

This brings you to a screen where you can give your backup a name.

Then, click the ‘Next’ button.

Name backup package

Duplicator will now run some tests to see if everything is in order.

If all items are marked ‘Good’, then click on the ‘Build’ button.

Build package

This process may take a few minutes, depending on the size of your website. You need to leave this tab open until the process is complete.

Once finished, you’ll see download options for ‘Installer’ and ‘Archive’ packages. You need to click on the ‘One-Click Download’ link to download both files to your computer.

Download package files

The ‘Archive’ file is a complete copy of your WordPress site. It includes all WordPress core files as well as your images, uploads, themes, plugins, and a backup of your WordPress database.

The ‘Installer’ file is a script that will automate the entire migration process by unpacking the archive file containing your website.

Step 2: Create a Database for Your Live WordPress Website

Before you can run the installer or upload the WordPress website from localhost to your hosting server, you need to create a MySQL database for your new live website.

If you have already created a MySQL database, then you can skip this step.

To create a database, you need to visit your hosting account’s cPanel dashboard. Then, locate the ‘Databases’ section and click on the ‘MySQL Database Wizard’ icon.

MySQL Database Wizard

On the next screen, there’s a field to create a new database.

Simply provide a name for your database and click on the ‘Create Database’ button.

Name new database

cPanel will now create a new database for you.

After that, you need to enter a username and password for your new user and then click the ‘Create User’ button.

Create new database user

Next, you need to add the user you just created to the database.

First, click the ‘All Privileges’ checkbox.

Check all privileges

Then, scroll down and click the ‘Make Changes’ button to save your changes.

Your database is now ready to be used with your WordPress site. Make sure to note down the database name, username, and password. You’ll need this information in the next step.

Step 3: Upload Files from Local Server to Live WordPress Website

Now, you need to upload the archive and installer files from your local site to your hosting account.

First, connect to your live site using an FTP client. Once connected, make sure that the root directory of your website is completely empty.

Normally, the root directory is the /home/public_html/ folder.

Some WordPress hosting companies automatically install WordPress when you sign up. If you have WordPress files there, then you need to delete them.

After that, you can upload the archive.zip and installer.php files from Duplicator to your empty root directory.

Upload archive and installer files

Step 4: Running the Migration Script

After you have uploaded the migration files, you need to visit the following URL in your browser:

http://example.com/installer.php

Don’t forget to replace ‘example.com’ with your own domain name.

This will launch the Duplicator migration wizard.

The installer will run a few tests and will initialize the script.

Duplicator migration wizard step 1

Under the Setup section, you will be asked to enter your MySQL host, database name, username, and password.

Your host will likely be localhost. After that, you will enter the details of the database you created in the earlier step.

Then, click on the ‘Validate’ button to make sure the details you entered are correct.

Validate settings

After that, click on the ‘Next’ button to continue.

Duplicator will now import your WordPress database backup from the archive into your new database.

It will also update URLs pointing to the local site to your new live site.

You can now click on the ‘Admin Login’ button to enter the WordPress admin area of your live site.

Admin login

Once you log in to your live site, Duplicator will automatically clean up the installation files.

That’s all. You have successfully moved WordPress from the local server to your live site.

Method 2: Manually Transfer WordPress From the Local Server to the Live Site

In this method, we will show you how to manually move WordPress from the local server to your live site. It will be useful if the first method doesn’t work or if you prefer to do it manually.

Step 1: Export Local WordPress Database

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

Export from localhost

In the ‘Export method:’ option, you can choose ‘Quick’ or ‘Custom’. Custom will provide you with more options to export your database.

But we recommend choosing ‘Quick’ and then clicking the ‘Go’ button to download your database.

Export WordPress database using phpMyAdmin

Step 2: Upload WordPress Files to Live Site

Now, we will need to move all your website files to the live site.

To get started, go ahead and open your FTP client and connect to your web hosting account.

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 will want to upload all the files in your public_html directory.

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

Upload WordPress files FTP

Step 3: Create a MySQL Database on Your Live Site

While your FTP client is uploading your WordPress files, you can start 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.

First, you need to log in to your cPanel dashboard and click on the ‘MySQL Database Wizard’ icon, which can be found in the ‘Databases’ section.

Select MySQL database wizard

On the next screen, you can create a new database.

You need to provide a name for your database, then click ‘Create Database’.

Name and create new database

cPanel will now automatically create a new database for you.

Next, you need to enter a username and password for your new user, and then click ‘Create User’.

Create new database user

After that, you need to add the user you just created to the database.

First, check the ‘All Privileges’ checkbox.

Check all privileges checkbox

Then, scroll down and click ‘Make Changes’ to save your changes.

You’ve successfully created a new database for your live WordPress site.

Step 4: Import WordPress Database to Live Site

The 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’.

Click on phpMyAdmin

This will take you to phpMyAdmin, where you want to click on the database you just created above. phpMyAdmin will show your new database with no tables.

Next, click on the ‘Import’ tab in the top menu. On the import page, click on the ‘Choose File’ button and then select the database file from the local site you saved in the first step.

Import database via phpMyAdmin

After that, click the ‘Go’ button at the bottom of the page. Your database will automatically be imported to phpMyadmin.

Step 5: Change the Site URL

Now, you need to change the site URL in your database so that it will connect with your live WordPress site.

In phpMyAdmin, look for the wp_options table in your database that you just imported above.

If you changed your database prefix, then instead of wp_options, it might be {new_prefix}_options.

Next, click on the ‘Browse’ button next to wp_options. Or, click the link in the sidebar to open up the page that has a list of fields within the wp_options table.

Browse the wp options table

Then, in the options_name column, you need to look for the siteurl option.

Then, click the ‘Edit’ icon.

Edit siteurl in phpMyAdmin

This brings up a window where you can edit the field.

In the input box for option_value, you’ll see the URL of your local install, which will be something like http://localhost/test.

You need to insert your new site URL in this field, for example: https://www.wpbeginner.com.

Then, you can save the field by clicking the ‘Go’ button.

edit the siteurl field

Next, you need to follow the same steps as above for the home option name. The wp_options menu can be a few pages long. Usually, the home option will be on the second page.

Then, update the home URL, so it’s the same as your live site URL.

Step 6: Set Up Your Live Site

Now that you’ve imported the database and uploaded your content, it’s time to configure WordPress.

At this time, your site should be showing an ‘Error establishing a database connection‘ error.

To fix this, connect to your website using an FTP client and open up the wp-config.php file.

You’ll be looking for the following lines of code:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

You will need to provide the database name, username, and password you created earlier.

Next, save the wp-config.php file and upload it back to your WordPress hosting server.

Now, when you visit your website, it should be live.

After that, you need to log in to your WordPress admin panel and go to the Settings » General. Then, without changing anything, scroll to the bottom and click the ‘Save Changes’ button.

Save general settings

This will make sure that your site URL is corrected anywhere else that it needs to be.

Once you’ve done that, go to Settings » Permalinks, then scroll down and click ‘Save Changes’ to ensure that all post links are working fine.

Save permalinks settings

Whenever you are moving a WordPress site from one domain to another or from a local server to a live site, you’ll face broken links and missing images.

A simple way to update the URLs is by using the following SQL query:

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 the top menu and add the query above.

Make sure you change it to your own local site and live site URLs and click the ‘Go’ button.

Fixing WordPress images and broken URLs after moving to live site

That’s it. You have now successfully migrated WordPress from your local server to a live site.

Hopefully, your live website is up and running smoothly. If you notice any errors, then you can check out our guide to common WordPress errors for help with troubleshooting.

We hope this article helped you move WordPress from a local server to a live site. You may also want to see our guide on how to create an email newsletter the right way or see our comparison of the best GoDaddy hosting alternatives.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

909 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. WPBeginner Staff says

    You can try deactivating all the plugins at once by renaming the /wp-content/plugins directory. Here is a tutorial.

    Usually plugins store settings in WordPress database so hopefully most of your settings will not get affected by the change.

  3. Neville Campher says

    I have moved my site from one domain to another, but my all my plugins are not working. If I re-install the plugins I will loose my settings, is there a way to keep my setting without loosing them

  4. orangedrum says

    I’m wondering the same thing. Just uploading my files didn’t work and when I try and re-export the database I’m getting an error telling me these databases already exist. Help!

  5. Ajay Walia says

    Thanks wpbeginner.com. i got an Error Establishing Database Connection error (local host to server). then i found your post on google. now i solved this error. :)

  6. David A. Bennett says

    Awesome tutorial! Just wondering, if I continued to develop on my website locally, could I simply re-upload the new files (‘m guessing the wp-content folder) via FTP to my site, or would I need to re-export the database everytime?

  7. Naveen Mallikarjuna says

    After trying another method, I tried your method outlined above and it worked perfectly. Thanks much!

  8. WPBeginner Staff says

    are you sure you have your site URL as your mysql host? it is usually localhost or a subdomain on your site like mysql.example.com. If you are unsure ask your hosting provider.

  9. Chandara Tieng says

    “Error establishing a database connection” I am getting this problem and now not yet fixed.

    here is my configuration in wp-config.php
    <>
    please help me define problem and fixed this.
    Thank ahead for kindness.

  10. ben says

    I quite appreciate your article but i have few problems. i have succesfully uploaded my site but the site is not recognising the style sheet and my admin page is blank after i logged in. what is the way out please?

  11. Anjali says

    Thank you for this guide. You mention that a plugin such as Backup Buddy or Duplicator can be used to make the migration easier. I’m VERY new to using WordPress, so the answer to this question may be painfully obvious. Would you install the plugin to the local site or the live site before the migration?

  12. Roland says

    First off: thanks a lot for your great blog – it gave me the idea to try WAMP to develop my three current WP site projects!!

    I did not install WP on localhost yet, because i am wondering if there could be a problem when I use a multisite installation during the move to the live server of my client.

    I would like to develop the 3 sites for my client in one single database through the WP multisite feature. However i am unsure if everything will be fine when going live because I intend to use an alternative multisite installation method by mapping the three distinct domains onto one SQL database (via this plugin: http://wordpress.org/plugins/wordpress-mu-domain-mapping/). I.e. I want to develop example1.com + example2.com + example3.com on my localhost in a multisite setup and export the sites later onto the production server.

    If someone could clear my doubts as to whether this could be a potential source for problems later on, please do so. :)

    In that case i would develop 3 separate instances of wordpress, although i would like to avoid this at all costs.

    Thank you! Roland

  13. WPBeginner Staff says

    The most probably cause is that your new database is empty, WordPress successfully connects to your new database. Then it finds out that the database is empty and assumes that its a new site. What you need to do is to import your old database. After that you will need to change your sitename and site url and update your links. See this guide.

  14. Crocker27 says

    Hi,

    Great tutorials thanks very much! I’ve created my own theme from scratch and am just in the final stages of putting it online, but I have hit a snag…

    What could cause the 5 minute install page to come up when I direct my page to the new sql database?

    I have exported the SQL database from my localhost. Created a new database on the server and imported it there and I changed the wp-config file to direct to the new database. When I did that I was directed to the 5 minute install page.

    When I leave it on the old database, my theme works (although the content/posts/menus etc are all wrong) so I don’t understand what I’ve done. I am guessing it’s something wrong with the database but I have no idea what!

    Thanks for your help!

  15. Paul Seidel says

    I’ve uploaded my website multiple times to the FTP, changed the wp-config, the SQL databases, etc – but for some reason “wordpress” is still in the address ( , etc.) and I can’t log into the backend. Help !

  16. Andrew Avantgardian says

    Worked like a charm, except i didn’t even need the last step (the MySQL query) for some reason all my links and pictures were fine after the transfer, perhaps it has something to do with the new version of WordPress.

    Anyways thanks for this guide

  17. Naveed says

    Thanks a lot for the tutorial. I was mislead by some plugins claiming automatic transfer.

    Excellent work. Keep it up.

  18. WPBeginner Staff says

    This article assumes that your live site is actually developed on localhost, so it does not assume that you have already taken down a live site to to work on it.

    In case you are working on a live site by creating a local copy on your computer. Then this strategy is usually used to only work on site’s layout, adding new features, or testing some functionality. This way you can work on your website without modifying any data and when you move the site from localserver to livesite your database usually remains unchanged.

    Hope this helps

    • npp07 says

      Thanks, but do you have any articles to recommend on how (if possible) to make changes to a website with a community contribution aspect (comments, forums, etc) and be able to develop to include creating posts (not just used for a blog, but something like BuddyPress or Symposium) without overwriting comments added between development versions?

    • npp07 says

      I thought I replied, but I don’t see it here… by adding new features, do you mean like adding pages and posts using BuddyPress? If a conversation keeps going on the live site while I am developing, will those conversations be lost or merged when I upload to the live site?

  19. npp07 says

    Thanks for the great article, I have done this with a static site before, but in the article you say this is how WPBeginner.com does it daily (but with BackUpBuddy). I haven’t used BackUpBuddy yet, but plan to for a new project.

    My question is how does this work for a site with the community commenting? Wouldn’t you lose the comments already on the database if you repeat this process daily and overwrite a database? Is there a slightly different step involved for building development updates onto an already live site?

  20. Husnain says

    All works fine .. but my header image not work (Crash) .. and when i save permalink in setting it says Connection not established !! :(

  21. Jenna says

    Hello!

    When I try to import gripped database I get:

    SQL query:


    — Database: `wpdb`

    — ——————————————————–

    — Table structure for table `wp_commentmeta`

    CREATE TABLE `wp_commentmeta` (

    `meta_id` BIGINT( 20 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
    `comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT ‘0’,
    `meta_key` VARCHAR( 255 ) DEFAULT NULL ,
    `meta_value` LONGTEXT,
    PRIMARY KEY ( `meta_id` ) ,
    KEY `comment_id` ( `comment_id` ) ,
    KEY `meta_key` ( `meta_key` )

    ) ENGINE = INNODB DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

    MySQL said:

    #1046 – No database selected

    How can I fix this?

    Thanks,

    Jenna

  22. Changa Masomakali says

    This is a great article!! Thanks so much for it. But I am not able to pull my site up. I think it has something to do with with the DB Hostname in the wp-config file. What should this be?

  23. Bloodico says

    This is absolutely a great article !! THANK YOU !!
    It would be perfect if you mentioned to also check the wp_postmeta when replacing ‘localhost/test/’ by ‘www.yourlivesite.com/’ on step 7
    and added a Step 8 for the.htaccess file which have to be modified too (if it isn’t done automatically ?)

    the line “RewriteBase /test/” has to be suppressed and the line “RewriteRule . /test/index.php [L]” has to be changed to “RewriteRule . /index.php [L”
    Once again a BIG thank you for this great article that made my day so easy !! ;)

  24. David says

    Im having issues logging in to my admin panel. Site displays correctly but links dont work even after executing the sql script. When I try to log in, no error is returned, the form just clears. Any ideas?

  25. Miguel Leite says

    Hey there.
    Wonderful post!! Thanks a lot, helped me doing this for my very first time, correctly.

    I’d like to ask: to do the reverse: moving wordpress from live site to local site, I just have to do de process starting with the live server and ending in the local?

  26. nickesh says

    i complete all the steps but wp-admin page cannot be accessed and it shows following error

    Warning: Cannot modify header information – headers already sent by (output started at /home/sulakasa/public_html/sulakasa/wp-content/themes/CherryFramework/includes/less-compile.php:155) in/home/sulakasa/public_html/sulakasa/wp-includes/pluggable.php on line 1121

  27. jellman says

    I’m confused, is this to also migrate posts? I have a wordpress site developed locally but with zero content yet. therefore can’t I just install wordpress on my dreamhost site, then move the theme files on my computer to the live server?

    • Mawuli says

      I have already exported my wordpress.com site to wordpress.org during the installation as your tutorial guided me.
      But my problem is, I already have a domain with wordpress.com and when i was trying to move my site to live, i received those feedbacks….May i know if wordpress.com is still my host or i need to purchase another hosting account?

  28. Mawuli says

    I have a domain with wordpress.com. After successfully installing wordpress with wampserver through your tutorial, I managed to design a new website, uploaded and used all the necessary plugins.

    Now, the next thing I want to do is to move to a live site and that’s why I arrived here to be able to display my new site but am stucked in the first step.

    I am using File Zilla as my FTP client. I was asked to enter my host name which I did with the name (wordpress.com). I entered my username, password and port number (21). But this is what I get when I try to connect

    “Error: Connection timed out

    Error: Could not connect to server”

    What shall I do? Do I need to buy a hosting service or wordpress.com is still my host. I don’t seem to get this hosting thing at all. Explain this to me.
    Thanks you

  29. MHK says

    All the steps in this work as expected….WONDERFUL!!!!, however it should be include in this tutorial as Step One or Prerequisite………That we need to install wordpress from Softaculous and then delete the database created by it and import the database into it and after installing wordpress from softaculous should import the WP files from FTP.
    I am facing a strange error. Chrome is opening my website as expected……IE keeps showing the Under construction page?? Any thoughts will be highly appreciated…….I have deleted the index.html file

  30. Yazz Am says

    Hello, I get ‘Error establishing a database connection’ at step 6 when I try to login to my wordpress admin panel. Help please.

  31. Ferdinand says

    I want to set up a site on local host which I want to manage locally. I would write the articles and upload them to webhost after I write them. Do I need to update the site and php database in the way that you mentioned above every single time I write a post? Or is there any way to upload only the files that got changed? This I want to know since it would be very time saving to manage the site offline for me.

  32. Rizky M R says

    My site has working, but i can’t open any page and post of my website, and also the image still doesn’t show up after the sql query fix

  33. Charlie Barnett says

    Hi, I have found your explanation extremely useful and have managed to trasnfer my locally hosted wp site live. However when I try step 6 to login I can’t seem to login and it throws the following error:

    Internal Server Error

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

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the 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.

    Does this make sense have I missed something in my upload?

    Thanks Charlie

  34. wanda serros says

    My site is up but it’s still not completely functional. When I click on some of my images to get an enlarged view I get a message saying ‘The requested content cannot be loaded. Please try again later.’

    I’ve looked in my database and I see that there are still instances of ‘localhost’…. in some fields. I did run the Update to ‘post_contents’ query already. Should I run additional queries to change every mention of ‘localhost’ in the database to my website address?

    Thank you. Your site has been very helpful.

  35. Lisa says

    I figured out how to upload the database, finally. made those text editor changes within the sql file first. Now I’ve done all of the other steps, including changing the wp_options “home” and “siteurl” … and also editing the wp_config.php file from within my live c panel file manager and making those updates. I still get an “error establishing database connection”. I did notice when I installed wordpress on my new hosted site, it created its own database (ss_1). Should i delete that one?

    • WPBeginner Support says

      The most common reason for the error is usually incorrect password, database, username or host information. It has nothing to do with other databases on your mysql server, so there is no need to delete them. Make sure you are entering correct information for your database in your wp-config.php file.

      Admin

  36. Karlo says

    I followed your instructions to make a local copy of my live website (the other way around).

    The only problem I’m experiencing is that the stylesheet isn’t loading and that my images arent showing up, not even on WP backend.

    Do I need to run another SQL query to fix this?

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.