You can always accelerate the development process by developing your WordPress site on your PC or Mac locally. If you have already developed your website locally, you will need to move your website from your local server to a live site.
- You will need a fully accessible WordPress site running on a local server.
- You will also need a web hosting and a domain name.
- Lastly, you will require an FTP program which will help you in uploading all the content of your local website to your live site.
Special Note: if you have not yet signed up to for a hosting plan, we recommend that you consult with the hosting reviews on HostAdvice. For reviews on WordPress hosting providers visit HostAdvice's Best WordPress Hosting Services page.
1. Exporting local WordPress database
We are using phpMyAdmin to export local WordPress database.
You need to visit “http://localhost/phpmyadmin/”. Then click on the option for your WordPress database. Look for the Export button in the menu bar at the top and then simply click on it.
Once you have clicked on the Export button, you will be required to choose between the two methods available. Namely, the are “Quick” and “Custom”. As the name suggests, quick method will be a simple and fast method while custom method will provide you will get some additional options.
We recommend you to choose the Quick export method and then finally click on Go.
2. Uploading the WordPress files to your live site
In this step, open your FTP client. Now you need to connect to your web hosting account in it. After doing this, you will be connected to your live site.
Next you need to upload your WordPress files and you have got to upload them in the correct directory. All you have to do is select all the local WordPress file and then upload them in your live site server.
3. Creating MySQL database on your live site
The FTP client will take some time in uploading your WordPress files to your live server. You can utilize this time by starting the process of importing your database to your live site server. In this article we are going to take you through the process of creating a database using cPanel. This is because cPanel is provided by most of the WordPress hosting providers.
First of all, login to the cPanel dashboard. Under the databases section, you need to click on the option which says MySQL Databases Wizard.
Now a new screen will be displayed. On this screen you have to create a database. Enter the name of your database and then click on the option of Create Database right below it.
Now we need to add the database user.
You will be redirected to a page once you have added the user. On this page you are required to set MySQL privileges for the user that has recently been added by you. Here you will have to give all the privileges to the user and the click on the button that reads Make Changes.
4. Importing the WordPress database on your live site
Now go to the cPanel dashboard and click on the phpMyAdmin option available under the databases section. Now you will have to click on the database that you just created. Your new database with no tables will be shown to you by phpMyAdmin. Next you have got to click on the button that reads Import in the same top menu where the Export button is present.
After clicking it you will be taken to the import page. Find the Choose File option on this page and then click on it. Now the file that you saved in the first step has to be selected. To start the import process click on Go.
5. Changing the URL of your site
In this step you will have to change the site URL of your database. We need to do this because it is a necessary step in order to get connected to your live site.
If you remember, we imported a table in the previous step. It was the wp_options table. You need to look for that table in phpMyAdmin. Look for [prefix]_options insted of wp_options in case you changed the prefix of you database.
Next, you have to click on either the link in the sidebar or the browse button beside the wp_options.
Now you will have to look for the site url under the field options_name. You will see the edit icon at the extreme left of the row. Click on it.
Now look for the column ‘option_value’ in the edit window that has just opened. Here you will see the URl of your local install. You need to swap this URL with your new site url. Click on the GO button once you are done.
Now you have got to repeat the same step for the option_name:home. Sometimes the wp_options page can be very long and make your head go round. So you need to simply find the home tab. You can use the pagination arrows to navigate between the pages. You should look on the second page as it is usually in there.
6. Setting up your live site
By now you must have noticed the ‘Error Establishing Database Connection’ error on your site. Now we need to fix it.
Use the FTP client to connect to your website. You need to edit the wp-config.php file. Remember the name, username and password the we created in the third step? They are to be provided here.
Now you just have upload the wp-config.php file back to the server after saving it.
Your website is live now!
Now login to the WordPress admin panel. Navigate to General under the Settings tab. Here you will have to ensure that the site URL is corrected everywhere by clicking on the button that reads ‘Save Changes’. Also you will have to make sure that all the post must be working fine. This can be done by going to settings and then navigating to the Permalink option. Click on ‘the Save Changes’ button.
7. Fixing the images and broken links
This error could be seen on your website. But do not panic. It is not due to any mistake in performing the above steps. But this error always prevails when you move a WordPress site from a local server to live server and from one domain to another.
To solve this error you have two options. One is to use the SQL query while the other is using the Velvet Blues WordPress plugin.
Let us take the SQL method. The following is an SQL query. It will help in removing the error.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'localhost/test/','www.yourlivesitelink.com/');
Next, you will need to go to phpMyAdmin. In phpMyAdmin click on database and find SQL in the top menu and click on it. Change the URLs of your local site and live site and simply write the above query there.
Go to your site and check thoroughly. If should be running smoothly without any error.
We hope our article helped you