How to Upload WordPress Files from Localhost to Hosting

For those of you who like to do website development using wordpress, you have to move to a hosting server so that your website can be accessed by many people. For some people who are new to wordpress and have never migrated / moved files from localhost to a hosting server, yiptechid will try to share the method with you. Check out the guide on how to upload WordPress files to hosting below:

List of steps that you have to do:

  1. Creating a database via MySQL Database in Cpanel
  2. Backup the local computer database
  3. Import the database via PhPMyAdmin in cPanel
  4. Upload files Using FTP / FileZilla
  5. Setting the wp-config.php file
  6. Editing MySQL Databases on Online Servers

1. Create a database via MySQL Database in Cpanel

  • If you haven’t created a database on the server, please create one first. Creating a MySQL database can be done at cPanel> MySql Database.
  • Create a new database with the name you want
  • Then create a username and password
  • After you create a new database and user, you must add the username to the database by scrolling down to the “Add User to database” section.
  • Then check all privileges => make change

2. Backup the local computer database

  • Prepare the WordPress application database that you created offline. Backup your database, if using PhPMyAdmin please access PhPMyAdmin from your web browser (http: // localhost / phpmyadmin)
  • Select the wordpress database that you want to upload from the drop down menu “database”. After the database is selected and displays its tables, click on the “export” button then select “Custom-display all possible options”
  • Select all and check the “Add Drop Table” box. Don’t change anything else unless you know what you are doing. Check “Save as file” press the “go” button at the bottom right of the browser. The browser will issue a save confirmation to the local computer.

3. Import the database via PhPMyAdmin in cPanel

  • When finished creating the database and user (step 1) and export the database to your local computer (step 2). Please open the PhPMyAdmin menu in cPanel. Select the database with the name you created in the first step.
  • The following is a display of images that have been successfully imported

4. Upload files Using FTP / FileZilla

  • Before you upload a wordpress file to a server via FTP, you should compress it in one Zip format first, all the files and wordpress installation directory on your local computer. Use normal (standard) compression for zip files and WordPress directories.
  • Upload the .zip file using ftp / filezilla to speed up the upload process and avoid upload failures. If you want to make the wordpress application the main web, please upload the wordpress zip file into the / public_html directory so that the wordpress application can be accessed via
  • When finished uploading, login to cPanel> File Manager, find the file you uploaded (in the public_html directory), right click on the file and extract it.

5. Setting the wp-config.php file

  • As of step 4, if you try to access the website you may encounter an error message. This is because the “wp-config.php” file from your local server does not contain any information related to your hosting account details. The file “wp-config.php” stores information about the database name, userDB, and password created on the hosting account. You need to change the details in it as follows:
  • Open your cPanel> File Manager. Locate the wp-config.php file in your WordPress root directory. Right click on the file and click ‘Code Edit’, change the line of code below according to the information we created in step 1:
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘nama-DB-localhost-PC’); ubah menjadi define(‘DB_NAME’, ‘ nama-DB-Hosting’);
/** MySQL database username */
define(‘DB_USER’, ‘root’); ubah menjadi define(‘DB_USER’, ‘nama-user-Hosting’);
/** MySQL database password */
define(‘DB_PASSWORD’, ”); ubah menjadi define(‘DB_PASSWORD’, ‘password-hosting’);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’); tidak dilakukan perubahan
  • When finished changing the configuration, press the Save Changes button.

6. Editing MySQL Databases on Online Servers

  • This is the last most important step. We have to edit the database that you created on the hosting site so that it can be connected to our WordPress files. We just need to change the URL, which in this example goes from ‘http: // localhost / name-localhost-pc / to’ ‘. (if the hosting you bought includes SSL, replace http to https)
  • Run PhPMyAdmin in Control Panel. Click on your database name, Select it and click on the wp_options table. In the display that appears, click [Browse]. In the edit table there are 2 things:
  • Edit the “siteurl” entry in the “option_name” column. Click edit or pen drawing to edit. Replace the ‘option_value’ with (match the directory path where the WordPress files are located and your domain name).
  • Edit the entry “Home” in the same column. If you don’t find it, click the arrow below the table. The editing method is the same as the siteurl entry above.
  • Access your domain name through a browser, and congratulations your website is available on the internet

Those are the steps for uploading wordpress files to hosting, follow the steps carefully. Hopefully this article is useful.

Leave a Reply

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