Support » Fixing WordPress » Error establishing a database connection

  • My blog is currently down with the message [i]Error establishing a database connection[/i]
    I ran WP debug and got this:

    Warning: mysql_connect(): No such file or directory in /home/…wp-db.php on line 1518
    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

    Are you sure you have the correct username and password?
    Are you sure that you have typed the correct hostname?
    Are you sure that the database server is running?

    I have not yet checked with my host yet, but the name and password are correct.
    I was reading through this page: and went to Sucuri SiteCheck as it recommended and ran a check. It said I have malware and the error was the same as the error from wp debug–but there were three of them.

    Now what?

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


    “Error establishing a database connection” means that:
    – a problem with the connection to your database
    – a problem with the credentials stored in the wp-config.php file not matching what mysql expects.
    – Try reviewing the following codex for some guidance:

    Sorry I must have wrote my post in pieces and then left out part. I did that first.visited that codex first.
    Everything was correct in wp.config when I checked.

    Moderator t-p


    Try contacting your host.
    Ask them if the server is online or if there are some other problems.

    My host fixed the issue…sort of.
    I have sent them a message to ask what they did, because now I am getting a different error message at the top of my site. It sounds like a plugin issue.

    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
    instead. in /home/rcr/public_html/loveanyway/wp-includes/functions.php on line 3624

    Notice: Undefined index: async in /home/rcr/public_html/loveanyway/wp-content/plugins/adsense-explosion/adsensexplosionopt.php on line 405

    Moderator t-p


    Glad you got it sorted 🙂

    It’s not really sorted. My site is up, but with a giant error message at the top–a different error message.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.