• Resolved Andyml

    (@andyml)


    Hi there,

    I awoke this morning to find I had an email from Google Webmasters telling me that it hadn’t been able to crawl my Robots.txt file. However, after doing some checking, it was only unable to get to it at the http:// of the domain, not the http://www. In fact I can’t access my website at all by going to the http://, but it is fine if I use www. Strangely I’m getting the error “Error establishing a database connection” when I use http://.

    I also noticed that my 404 page has totally disappeared, and if I try to go to an incorrect url, I also get the “Error establishing database connection” error.

    I can’t figure out what could have changed or what could be wrong. You can see the working website here – http://www.naildesignsforyou.com and then it not working at http://naildesignsforyou.com
    Also the lack of a 404 page is demonstrated by going to a random wrong url like http://www.naildesignsforyou.com/asijoajgsp

    If anyone has any ideas what might be causing this and how to fix it I’d really appreciate it.

    Thanks very much!

    – Andy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator t-p

    (@t-p)

    Error connecting to your database:

    In nutshell, you’re getting this error because WP is unable to establish a database connection. Reason why WP is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. Majority of the times this error happens because of some sort of server error. Also, there could be other factors as well. To troubleshooting this problem:
    – double check your wp-config.php file settings for the database name, database username and database password, and the host name (e.g., “localhost” Vs. something else). This is where most errors occur.
    – Then make sure wp-config.php is in right location.
    – Then check that you don’t need to change the database host from “localhost” to something else. You can get that info from your hosting provider.
    – Check you have actually created a database with the same database name as is in your wp-config.php file.
    – Last, but not least, if all that information is correct your database probably has a problem with it. Contact your hosting provider if the database server is offline (if the problem suddenly happened), or if they have any other problem at their end, or they made any changes to your account, or if there are any limitations/restrictions, or if the hosting package is set to Windows and not Linux, etc.
    – If the error is intermittent then it’s your server. What’s happening is that the web server and/or the database server are gettign overloaded and the connection is droping out or is refused for a short time. That gives you the database error as the website can’t connect to the database. To fix this, you’ll need to talk to your hosting company as they are the only ones that can do anything about hardware issues like this.
    – There are also many threads on this topic on these forums: http://wordpress.org/search/Error+establishing+a+database+connection?forums=1

    Thread Starter Andyml

    (@andyml)

    I can’t believe I didn’t check the config file before posting here. What an idiot! I just assumed it would be something far more complex. How wrong I was.

    Anyway, you were right, the database name was wrong in the config file. I’d installed a 2nd WordPress installation into a sub directory and that had been acting oddly recently. It must have changed the root config file’s details.

    All sorted now though!

    Thanks for the help!

    Moderator t-p

    (@t-p)

    you are welcome 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No 404 Page and "Error establishing database connection"’ is closed to new replies.