1. Home
  2. Website
  3. Wordpress
  4. How do I upload my WordPress website from my local computer ?

How do I upload my WordPress website from my local computer ?

This article provides you with steps to upload your WordPress site fro your local computer. This article is valid if you created the WordPress website on your local computer and was able to browse to it via localhost.

 

Before You Begin

 

In order for you to migrate your locally developed WordPress site to a live server, you need to have a few things in place. First, we’re assuming that you have a WordPress site running on the local computer, and you have full access to it.
Next, you’ll need to have a domain name and web hosting.  https://gridhost.co.za/web-hosting/

 

Step 1 – Export Local WordPress Database

 

  • The first thing you need to do is export your local WordPress database. We’ll 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. We recommend choosing Quick, and then click the Go button to download your database.

 

 

 

exporting your wordpress database using phpmyadmin

 

Step 2 – Upload WordPress Files to Live Site

 

Now we’ll need to move all your site files 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 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.

 

 

Uploading WordPress from localhost to live site

 

Step 3 – Create MySQL Database on Host

 

While your FTP client is uploading your WordPress files, you can start importing your database to the live server.
  • To get started, you can log in to your cPanel dashboard and click on the MySQL Databases icon which can be found in the databases section.

 

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

 

Create a new database
  • After creating your database, scroll down to the MySQL Users section and create or add an existing user to the database.

 

create a new database user
  • After adding the user, cPanel will take you to set MySQL privileges for that user. Simply grant all privileges to the user by making sure every box is checked, and then click the Make Changes button.

 

grant all privileges to database user

 

Step 4 – Import WordPress Database on Host

 

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. This will take you to phpMyAdmin where you want to click on the database you created in Step 3. PhpMyAdmin will show your new database with no tables.
  • 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 you saved in Step 1.
  • Lastly, press the Go button at the bottom of the page. PhpMyadmin will now import your WordPress database.

 

import phpmyadmin database

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 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 the wp options table
  • Under the field options_name, you need to look for site URL. 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, http://www.wpbeginner.com
  • Save the field by clicking the Go button.

 

edit the siteurl field

 

  • 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 site URL.

 

Step 6 – Set Up Your Live Site

 

Now that we have imported the database, and all of our content should be uploaded, it’s 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.
  • Next, you need to login to your WordPress admin panel and go to Settings » General. Without changing anything, scroll to the bottom and click the Save Changes button. This will ensure that the site URL is corrected anywhere else that it needs to be.
  • After that go to Settings » Permalink and click Save Changes to ensure

 

 

 

 

Updated on March 6, 2023

Was this article helpful?

Related Articles