Uploading WordPress site from local server to a live web server

Recently, i finished a website in local server WAMP and uploading to Bluehost; i got into a problem of uploading sql file, keep having different errors such as data connection error, and the 1044 error, which look like this:

ERROR 1044: Access denied for user ‘dbuser’@’localhost’ to database ‘db name’

Where dbuser is my database username and database name after.
Searching online for an answer is also frustrating because the answers normally don’t apply to my case or do not work, but playing puzzle and put them together, adding a lot of testing, i finally got it done and here is how, for the one that like me, playing with them to learn them.

I assume that you already have a local server with a wordpress site, an account with hosting service and a FPT running .( You can also use the file transfer within the hosting site)

1. Changing the URL:

– Go into your Worpress site admin in your local server, then go to General->Setting and change the URL from the localhost to your actual domain name.

2. Export your SQL file:

– Go to myPHP in local server, look for a database with wp_ prefix, you can also look into wp_config file by go to www folder->wp_config.php, open it up and the first couple lines will include the database name, that’s the one you need to export, this database include the information about the themes and your site you have been working on.
-Export it to a .sql file or you can zip it also, remember to keep the “utf-8” setting

3. Editing the SQL file:
Open the file you just exported, find this two line and delete it:

CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `test`;
This is important, because when we upload it, it will try to create the database name ‘test’ since it not exist in the server, and failed, the result is can not complete the upload.

4. Upload your files:5. Creating a new database in your hosting server:

– Go to MySQL, create a new database
– Create a new user
– Assign that user to the new database with all privileges and password and stored information somewhere for later use.

6. Edit wp_config.php file

– If the upload is done, in FPT, find the wp_config.php file to edit (you can download it, edit and upload back on, to be sure, you can make a copy.), you can also edit before uploading, but it’s a good ideas to edit the file after uploading if you want to continue testing the site in local server.

– In the First couple lines of this file, you will see this:
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘test’);

/** MySQL database username */
define(‘DB_USER’, ‘root’);

/** MySQL database password */
define(‘DB_PASSWORD’, ”);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

– Now you need the information of the database you just created in the server, replace them accordingly in the file
– Save it and upload it back on.

7. Upload the SQL file.

Now in the CPpanel , go to myPHP, login and find the username we created for, which will lead us to the new database, click import-> choose the SQL file we export earlier.

You are done uploading your WordPress site, now go to the site and complete the “5 minutes install ” of WordPress. You then can login to wp-admin with the password, the same as local, you can then change the user name and pass, if you did install the Mojo, then use the root as user name and pass assigned by Mojo.

Now your site is ready, but will have some broken images or links, it’s normal for the process (so i heard).
I hope this article will help you upload your hard work painlessly, if you see i am wrong somewhere or need to put in any more info, i appreciate any feed back so we can learn together.

4 Comments

  1. Hello, Neat post. There’s an issue along with your site in internet explorer, might test this? IE still is the marketplace leader and a huge component of other folks will miss your fantastic writing due to this problem.

  2. Үou aϲtually makе it sеem so easy tօgether with
    your presentation but I find ɦis topic to Ьe rеally one tɦing tҺat I feel I’d by no mеans understand.
    It kіnd of feels tooo complex аnd verу vast
    for mе. I am looƙing ahead tto ʏour next publish, ӏ աill attempt tο get thhe cling of іt!

Leave a Reply

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