Grow your CSS skills. Land your dream job.

wp Error establishing a database connection

  • # March 28, 2013 at 7:43 am

    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.
    Thanks

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

    # March 28, 2013 at 7:57 am

    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: http://127.0.0.1/mywebsite
    online path: http://mywebsiteonline.com

    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 – http://mywebsiteonline.com/
    GOOD – http://mywebsiteonline.com

    # March 28, 2013 at 7:57 am

    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).

    # March 28, 2013 at 8:11 am

    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.

    # March 28, 2013 at 8:20 am

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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".