Family Encyclopedia >> Electronics

How to move WordPress from localhost to live site

Building a WordPress site locally is a smart way to speed up the development process. Earlier we showed you how to install WordPress on your Windows computer using WAMP or on Mac with MAMP. Once you're done perfecting your website on your own computer, the next step is to go live with the website and share your creation with the world. In this article, we'll show you how to move WordPress from a local host to a live site, step by step.

How to move WordPress from localhost to live site

For the sake of this article, we will show you how to manually move WordPress from a local host to a live site step by step, so you can learn the process. However, you can make this migration from local server to live site much easier by using one of two plugins:BackupBuddy or Duplicator. You can find more information about that process in our guide to moving WordPress to a new host or server with Duplicator.

Before you start

In order to migrate your locally developed WordPress site to a live server, you need to have a few things in place. First, we assume that you have a WordPress site running on a local server and have full access to it.

Next, you will need to have a domain name and web hosting. We have a list of the best WordPress hosting providers you can choose from.

To speed it up, you can use Bluehost. They are an official WordPress recommended hosting provider and are offering our users an exclusive 60% discount + a free domain.

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

Finally, you'll also need to have an FTP program and know how to use it in order to upload your content to the live site.

Ready to start? Let's start migrating your WordPress site.

Step 1:Export the local WordPress database

The first thing you need to do is export your local WordPress database. We will use phpMyAdmin to do that. If you're not familiar with it, you can refer to our guide to WordPress database administration using phpMyAdmin.

Just go to http: // localhost / phpmyadmin / and click on your WordPress database. Then click on the Export button on the top menu bar.

How to move WordPress from localhost to live site

In the Export method Option, you can choose "Quick" or "Custom". Custom will give you more options to export your database. We recommend choosing Quick, and then clicking Go button to download your database.

How to move WordPress from localhost to live site

Step 2:Upload WordPress files to Live Site

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

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

Once you're connected to your live site, make sure you upload the files to the correct directory. For example, if you want the site to be hosted on yoursite.com, then you want to upload all the files to your public_html directory.

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

How to move WordPress from localhost to live site

Step 3:Create the MySQL database on 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'll show you how to create a database using cPanel.

To get started, you can log in to your cPanel control panel and click on MySQL Databases Icon that can be found in the database section..

How to move WordPress from localhost to live site

On the next screen, create a database by entering a name for your database and clicking Create Database button.

How to move WordPress from localhost to live site

After creating your database, navigate to the MySQL Users Section and create or add an existing user to the database.

How to move WordPress from localhost to live site

After adding the user, cPanel will take you through setting MySQL privileges for that user. Simply grant all privileges to the user by making sure all the boxes are checked and then click Make Changes button.

How to move WordPress from localhost to live site

Step 4:Import the WordPress database into the live site

The next step in the process is to import your WordPress database. Go to the cPanel control panel, 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 in Step 3. PhpMyAdmin will display your new database with no tables.

Click on the Import tab in the top menu. On the import page, click Choose file and then select the database file you saved in Step 1.

Finally, press the Go button at the bottom of the page. PhpMyadmin will now import your WordPress database.

How to move WordPress from localhost to live site

Step 5:Change the site URL

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

In phpMyAdmin, find the wp_options table in your database that we just imported in step 4. If you changed your database prefix, instead of wp_options it might be prefix _options.

Click the Browse Button next to wp_options or the link you see in the sidebar to open the page with a list of fields within the wp_options table. See screenshot below:

How to move WordPress from localhost to live site

Below the options_name field , you need to search for Site URL . Click the Edit Field icon on the far left at the beginning of the row.

How to move WordPress from localhost to live site

When you click on the edit field, an edit field window will appear. In the input box for option_value, you will see the URL of your local installation probably something like:http: // localhost / test . Carefully insert your new site URL into this field, for example:https://www.wpbeginner.com

Save the field by clicking the Go button.

How to move WordPress from localhost to live site

Next, you need to replicate this step for the option name:home . The wp_options page can have a few pages, so just find the home tab. It's usually on the second page you can navigate to by clicking the pagination arrows in phpMyAdmin.

Update the home url to be the same as your Site URL .

Step 6:Set up your site live

Now that we've imported the database, and all of our content should load, it's time to set up WordPress. At this point, your site should show a database connection error establishing error. To fix this issue, connect to your website using an FTP client and edit wp-config.php proceedings. Provide the database name, username, and password you created earlier in Step 3. Save the wp-config.php file and upload it back to your server. Visit their website, and it should be live now.

Next, you need to log in to your WordPress admin panel and go to "General Settings . Without changing anything, scroll to the bottom and click Save Changes button. This will ensure that the site's URL is fixed anywhere else it needs to be.

After that go to Settings »Permalink and click Save Changes to make sure all post links are working fine.

Step 7:Fix broken images and links by updating paths

Every time you move a WordPress site from one domain to another, or from a local host to a live site, you will face broken links and missing images. You can use the SQL query or 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:

 ACTUALIZAR wp_posts SET post_content = REPLACE (post_content, 'localhost / test /', 'www.yourlivesite.com/'); 

Just go to phpMyAdmin, click on your database and then click on SQL from the top menu. Write this query, but don't forget to change it with your own local site and live site URLs.

How to move WordPress from localhost to live site

That is all! Hopefully now your live site is working properly. Be sure to check your site to make sure everything is working as expected. If you notice any errors, you can refer to our guide to common WordPress errors for troubleshooting help.

If you do this regularly, we recommend getting BackupBuddy because it will make your life so much easier.

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