Well now a days majority of developers tend to develop their WordPress site on local hosts after which they transfer it to the live servers. Local host has many advantages that majorly provides fast uploading speed and is more secure for uploading files to the server.
The migration or transfer of WordPress site from local host to live server or from one domain to another is very easy and interesting if you follow the following steps:
In order for you to migrate your locally developed WordPress site to a live server, you mostly need two things.
First is the local server on which you have created your site locally. 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 easily migrate your content over.
You would need to have a FTP client and text editor, so you can upload your content to the live site.
Keep in mind that screenshots used in this article are from local host and web hosting.
1. Export Local Database
Start your local server and access phpMyAdmin. The phpMyAdmin can be accessed at address http://localhost/phpmyadmin in your broweser . All databases are listed in the left side panel. Select your WordPress database and click on “Export” button.
Select “Quick” export method, and then click on “Go” button. You will be prompted to save the export file on your computer. Save file under desired name and keep extension as .sql .
2. Uploading WordPress Files to Live Server
Its time to open an FTP client and connect to your live site. Once you are connected to your live site, then make sure you upload the files in the right directory.
For example if you want the site to be hosted on your site for example example.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.
The screenshots uploaded below are for your easiness and correct path.
Login to your cpanel hosting account.
Go to File Manager and upload your WordPress files in public_html/.
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. So now to create a database using cPanel, simply you are already logged in to your cPanel dashboard and click on the MySQL databases icon which can be found in the databases section.
On the screen you can create database for your site by respective name.
After creating a database, scroll down to MySQL users section and create new user 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.
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. This time 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 zipped database file you saved in step 1 with respective name. Lastly, press the Go button at the bottom of the page. PhpMyadmin will now import your WordPress database.
5. Changing the Site URL
After setting everything you need to change the site URL because you were using the local host address. In your phpMyAdmin, click on the respective database of your site you want to make live, then look for the wp_options table in your database. 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.
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 host install probably something like:
http://localhost/wordpress. Carefully insert your new site url in this field, for example:
Save the field by clicking the Go button.
Next, you need to replicate this step for the option name: home.
Update the home url to be the same as your siteurl.
6. Setting Up your Live Site
Its time to check the site we made on live server after importing all the WordPress files and making database for it,so we should configure WordPress. If you browse you website probably for example www.YourSite.com you will get the below shown error in displayed in screen shot.
To fix this, connect to your website using an FTP client and edit
wp-config.php file in public_html/ directory. Provide the database name, user and password you created earlier in Step 3. Save the wp-config.php file and visit your website, and it should be live now.
Congratulations you made it!
If you found this article helpful, please leave your comment and if you get any problem connecting to your live server or anything please feel free to post your query. We will respond you within no time.