How to Take Your WordPress Site From Local to Live

Step 1: Exporting Local WordPress Database

For this, just go to http://localhost/phpmyadmin/ and (choose) click on your WordPress database. Next, click on the Export button at the top. While exporting choose custom, which will provide you with more options to export your database. Select all tables to export and gzipped for compression. Now, scroll down to press the Go button to download your database in the compressed zipped format.

Step 2: Uploading WordPress Files

Now open cpanel for your live site. Now select your local WordPress files and upload them to your live server. For example, if you want the site to be hosted on, then you would want to upload all files in public_html directory.

Step 3: Creating MySQL Database on Live Site

While your WordPress files are being uploaded, you can spend this time on importing your database to the live server. For this you have to create a database on your cPanel. As you are already logged in, click on the MySQL databases icon which can be found in the databases section.
For creating a database, click on ‘New’ and add database name. After creating a database, scroll down to MySQL users section and create or add an existing user to that 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 is to import your WordPress database. For this, click on the newly created database and click on the Import tab at the top. On the import screen, click on choose file button and then select the gzipped file you exported/saved earlier. Lastly, press the Go button at the bottom of the page. phpMyadmin will now import your WordPress database.

Step 5: Changing the Site URL

i. Cick your newly made database
ii. Then select your wp_options table.
iii. Your wp_ prefix may differ depending on your install settings.
iv. Click Edit beside either the siteurl or home entries.
v. Enter in your new value in the option_valuie field, then click Go
vi. Also, update the home url to be the same as your siteurl.

Step 6: Final Set Up

Browse your files at the cpanel or connect to your website using an FTP client and edit wp-config.php file. Provide the database name, user and password you created earlier. Save the wp-config.php file and upload it. Your site should be live now.

Step 7: Fixing Images and Broken Links by updating Paths

More often we face issues broken images and broken links while migration our sites. For those who want to do it via SQL, here is a simple SQL query:
UPDATE wp_posts SET post_content = REPLACE(post_content, ‘localhost/test/’, ‘’);

That’s all, your live site should be up and running by now. Run your site to make sure that every thing is working fine as expected.

Leave comment

Your email address will not be published. Required fields are marked with *.