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.

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.

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.

On the next screen, create a database by entering a name for your 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.

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.

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:

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.

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:

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.

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

Comments

Was a great help, this tutorial. I had some 500 server errors fixed after editing the htaccess.php file. But I still have no access to the wp-admin dashboard? Anyone got the same emptiness on the backend link? what could be the fix?

I have troubles with my new site address. Everything else seems to work just fine.

In phpmyadmin if I change the siteurl to direct the site to the correct subfolder, the website content disappears when the “home” option value is correct. Then again if I also change my home-value into the same address as the files are in, meaning the same address as siteurl, then I see the content but the address is not what I wanted it to be. I’ve also tried to use Velvet Blues -plugin but nothing happened.

In my case the WordPress url is different from website url, so basically the changes won’t affect in admin panel Settings.

The other part of making backups is restoring your sites from backups. cPanel does not make that part easy. Configurations may differ from one site to another. Sometimes user may even want to move to a web host that does not offer cPanel. For more advanced users who can troubleshoot these issues, cPanel backups can be a good option. But for most beginners it can be difficult. There are other backup options as well, take a look at our pick of 7 Best WordPress Backup plugins.

Hi, I’m still struggling withe the migration of my local hosted WP multisite to a webserver. Replaced all the urls’s as far as I can tell but still the navigation doens’t work. Ik can enter the root which shows the homepage correctle but clicking a navigation link I get this error.
“Not Found
The requested URL /index.php was not found on this server.”

Although the paths of the menu links(shown on hover) look fine. Any Idea where to go look to solve this? Thanks in advance.

After importing the database, I tried to do step 5. However, when I click on wp_options, i do not have an edit spot. It says “current selection does not contain a unique column. Grid edit, checkbox, edit, copy and delete features are not available.”
Why is this happening?
Thank you

You can find out your live site’s database information by vising phpMyAdmin through cpanel. Notice the database name, mysql host, mysql username, and password and then fill in that information in your live site’s wp-config.php file.

On your local site go to localhost/phpmyadmin/ to find out the correct database name.

I completed all the steps and now my live site just says Error Establishing database connection and I cannot access my localhost at all – it is just a white screen. When in Step 6 it said to change your config.php file I accidentally changed the info in my local config file instead of the one updated through MySql but I figured that one out and changed the info back in my local file to what I thought it was before, but now when I go to localhost/wordpress (where I had previously gone before) it just shows a white screen. And my live site says Error Establishing Database Connection. So confused. Any help would be lovely.

Hi, I have uploaded my first page with the help of this post and it has been working perfect since than. Now I have a problem with an other site. I went through all the critical points again and again but I have always the same issue. The site is working (with broken links) but I can’t log in to the admin site. I changed the database at phpmyadmin and the wp-config.php file also. They have the same username and same password so they have the same datas and yet I have the problem. How does it possible?

Hi there, my WordPress website has just moved to a new ip address, and I followed the steps at the bottom to fix broken links. It said that it fixed them but my website is still not displaying properly. Some images are displaying as broken images and some image sliders are not showing up at all. The website also seems a hell of a lot slower. How do I fix this all?

Hi there, my WordPress website has just moved to a new ip address, and I followed the steps at the bottom to fix broken links. It said that it fixed them but my website is still not displaying properly. Some images are displaying as broken images and some image sliders are not showing up at all. The website also seems a hell of a lot slower. How do I fix this all?

Hi. I’ve followed all the steps (I think so) and now I no longer have the error message about not having a database connection – instead I now just have a blank white screen. Can you tell me where I’ve gone wrong?

Unfortunately it doesn’t work for me. I think that there are so many variables with something like this. Your steps work for you, with your scenario, but for someone else it can be very easy to end up with something else which stops the process working. Migrating wordpress is a real chore in my experience.

Hi,
Great tutorial, thanks a bunch. I’m doing my first wp redesign for a client who already has a well established blog with posts images etc. I’ve exported all of her data into the local site, designed a new theme with new pages etc. While importing her posts locally and selecting the option to download attachments, the posts have appeared but none of the images and I’m about ready to upload everything to her server.

Do I just upload the theme files and in doing so will my modifications be present? Or do I need to upload everything as this tutorial suggests. She has over 2000 posts, an image for each, and I’ve got new images, pages, and layout.

If you can either make a tutorial for moving/importing a redesigned or newly designed blog into an existing blog with posts pages etc. Or point me in the right direction, That would be great.

The client won’t give me access to the server itself and insists on doing the ftp himself because he saw on the news that he could get his identity stolen or some such nonsense. I explained that he could set access restrictions on a separate login but he insists he do it.

And the don’t want me working directly on the site because they’re worried about downtime while I update and build it.

You can’t always be picky when it come to clients and I don’t really have a choice I’m just about done.

Good day.
Thanks for this easy to follow tutorial.
I managed all the steps and my site seems to be connected, except that my theme is missing. All the files are in place with their stylesheets, but the site seems to be displaying plain html.Has anyone else experienced this?
Not sure how to go about fixing it.

Thank you so much.
I’m definitely a wp beginner and this post was just of an wonderful help. Everything went on flawless.
I’m really enjoying working as a web designer and wp developer. And I hope I’ll get more and more of these kind of jobs, and more challenging ones. I learned so much while doing this very first one.
Thank you again.

But I wonder how I can export to live when WordPress is already installed live? I redesigned the website from scratch, only thing is that I used the same theme. What would be the best way to get this live?

Great tutorial, thanks for the help.
Like some others, the up_user updates don’t work and the links on my site are still calling the localhost. I’ve also been booted out as the admin user and cannot login to update permalinks etc.
I’ve found a tutorial to re-instate an admin user via phpmyadmin so I’ll give that a go and see if I can get back in!
Cheers

Great guide, but having a little bit of trouble and wondering if you can help.

I’ve done everything above, but when I try to go on to the …/wp-admin page I get this: ‘Warning: require(/home/username/public_html/wp-includes/pomo/mo.php): failed to open stream: No such file or directory in /home/username/public_html/wp-settings.php on line 76′

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.

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).