The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other wp Error establishing a database connection

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #43728

    Hi, Can anyone help?

    I’m trying to move the wp site I’ve been working on to a /url from localhost.
    This is what I’ve done so far:
    1. exported db .sql
    2. created a new db and user with all privileges in host
    3. imported db .sql successfully
    4. copied my wp files into the /url
    5. changed the .config file with define(‘DB_NAME’, ‘database name’); define(‘DB_USER’, ‘database user’); define(‘DB_PASSWORD’, ‘password’); define(‘WP_HOME’, ‘http://www.urladdress/’);
    define(‘WP_SITEURL’, ‘http://www.urladdress/’);
    define(‘DB_HOST’, ‘localhost’);

    and I still get this error. Is there something I’m missing?
    Would really appreciate some help.

    ps. I’ve tried both with the home/siteurl and without and still same error


    just before level 3, you need to open your .sql file in the editor and rename the path – instead of the localhost path you need to put the domain, for example:

    localhost path:
    online path:

    just copy and replace all.. after that save the file and continue with step 3…

    * make sure when you changing that domain it’s without the last slash /

    for example:
    NOT GOOD –
    GOOD –


    9 out of 10 times it’s just a mistake/typo in the database name, user, or password. Double triple check if all that is correct. Lord knows I keep having trouble with it all the time!

    I think exporting and importing the database doesn’t have anything to do with this problem (the config file will just look if there is a database/user, not directly if it has contents or not), nor do I think the WP_HOME and WP_SITEURL have any impact (meaning whether they’re correct or not, that’s probably not why you get that error).


    and it could be also the functions.php, make sure that you don’t have an empty line at the beginning of the code or at the end of the code.


    Hi, Thanks all. It was a typo in the end!!!
    Thanks for your help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.