How to Move WordPress From Local Server ( WAMP or XAMPP ) to Live Site

Pre-Steps :

In order for you to migrate your locally developed WordPress site to a live server, you need to have following things.

  1. Web hosting Access
    1. To create New Database.
    2. To Create New User of database.
    3. FTP Access to upload locally developed WordPress files.

 

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. Simply go to http://localhost/phpmyadmin/ and click on your WordPress database. Next, click on the Export button from the top menu bar.

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.

To connect to your live site using FTP you will required following information.

  1. Hostname (Eg. mysite.com or 103.250.87.106)
  2. User (Eg. mysiteuser )
  3. Password
  4. You might have to select Encryption as TLS/SSL Explicit encryption for FTP Protocol.

For example if you want the site to be hosted on mysite.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.

To access Cpanel type http://yoursitename.com/cpanel in browser.

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: Changing the Site URL

Now you need to change the site URL, so you can setup your live WordPress site.

Open the SQL database file you saved in step 1. Replace all your localhost URL with live Website URL.

 

For Eg. if Local Url is http://localhost/myfolder and your Live Website URL is http://mysite.com

then replace http://localhost/myfolder with Live Website URL http://mysite.com.

Save Your SQL File.

 

Step 5: 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 sql database file you saved in step 4. Lastly, press the Go button at the bottom of the page. phpMyadmin will now import your WordPress database.

 

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.

 

Voila, so we have finally finished transferring our WordPress site from localhost to live server. For troubleshooting and questions, feel free to leave us a comment below and we will try to help out as much as we can.