Note: there are plugins that can automate this process. This tutorial will cover the manual steps without requiring the help of a plugin.
How to Move WordPress from Localhost to Production Server
Create new database on live server
Even if your Web Host Comes from Cpanel then you have to login into the Cpanel after that click on (MySQL Databases) in the Databases Section (Cpanel)
Create new database user
Lets start that how create a new database user for that you will need to open next windows, You must fill the Textbox with your username and with Strong Password, Then you have to click (Create User) Button. Then you must record the username and Password Because you shill need it later.
For that once again Go back in the Newly Displayed Window.
Add user to database
Go Down or Scroll down to (Add user to database) then you have to select the user created from the user Dropdown List and you must select Database Created from the Database dropdown List.
Next you have to click the Add Button.
After clicking in add button on the next window, You must click to (All Privileges) Then checkbox followed by the Make Changes Button. Once again you must click to go back on the Windows that Opens.
The windows that is Displayed, You have to check Double to see that whether your database contains the user name you just created, If you are done then click on the Home Button at the Topmost Left Corner of the Page.
Migrate database from localhost
For Migrating your Database from Local host you have to Open PHPmyAdmin. or the database management program you are using already.
Located to your WordPress Database.
After selecting the database you must Scroll down then Click on (Check all)
After that Select with Dropdown The Menu Then Select Export.
Then In the very next Screen before that ensure that the Format is on SQL after that click on go remember that you must save the exported database with the Extension (SQL).
Importing the database
For importing the database go back to the Cpanel on your Live Server under (Databases) you must click on (PHPmyAdmin)
On the left pane you would see a list of databases in the Screen. From this list you have to click on the name of the database you created at the start of the tutorial and then click to “Import.” Navigate to the SQL file you saved on your local computer and import.
Even-though If everything went well, it world bring you back to the phpMyAdmin main screen. Then you will be done migrating the database to the live server.
Move localhost files to Cpanel
In the localhost, you have to open your file manager and navigate to the WordPress folder (the folder that contains the “wp-admin,” “wp-content” and “wp-includes” folders). then Compress the whole WordPress folder into a zip file.
In your cPanel in the live server, you must open the “File Manager” under the “Files” section. Then you have to Select “Document root for” and then make sure the domain you need to move your website to is selected and hit “Go”.
Go to next page make sure that Public HTML is selected on the Left pane than you how to click on Upload.
After that Navigate to the location of the compressed zip file and upload it. Once complete, then click the “Back to” link.
Your zip file at this point would be display as a file in your “public_html” folder. If it doesn’t, click “Refresh.”
After you select the Zip File and click to Extract it at the Top-Left corner. If you done it then delete the Zip File.
Editing the WP-config File
At the Final Step is to Edit the WP-Config.PHP File to change all local host setting to Production Settings.
Go to File Manager then go to Public HTML select the File “wp-config.php,” and click “code editor.”
Go to Replace the Database name with the name of the Database you created in your Cpanel also, You must change the “DB_USER” and “DB_PASSWORD” to the one that you created earlier.
Check for the “WP_HOME” and “WP_SITEURL” values. If they don’t exist,then add the following lines to the wp-config.php file:
Remember that to change the “your-live-url” to your actual domain URL.
Then Save the WP-Confiq.PHP File and exit.
Once you done it, Then type your own domain name in the Address bar of your browser and your site must be up and Running. Check every single page of your website to go admin panel to make sure that everything is working fine.