• Today, randomly my WordPress site decided to be Up and Down several times. On the Wp-Admin page it says “Error Establishing a Database Connection” and sometimes a 504 Error also…

    Connected to BlueHost and they said they can’t find anything wrong with the connection. However I haven’t changed anything in my WordPress files to make this happen?

    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?

    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    Also every once in a while I do get to the WP dashboard so the password/username thing isn’t it

Viewing 15 replies - 1 through 15 (of 18 total)
  • 1. Check your wp-config file to be sure your database parameters are correct
    DB_USER, DB_PASSWORD, DB_HOST, DB_NAME

    2. What kind of bluehost product do you use ? Shared hosting ? VPS hosting ?

    3. a HTTP 504 error means a gateway timeout. So it seems to be a problem on the hosting infrastructure.

    Thread Starter knightgambit

    (@knightgambit)

    This is all new to me…in terms of coding WP. I cant even reach the Admin Dashboard. I talked to BlueHost several times and all they said is “Need to optimize your site better” but nothing else they could do. Doesnt help when I can’t even access the site….I’m might need to upgrade WP through FTP and maybe that’ll fix it?

    tsagita

    (@lemurianisindonesia)

    Hi bro, your problem site is “Error establishing a database connection”.. this is cause your site cant connect to mysql server.

    Please check:
    1. Open wp-config.php, check line DB_USER, DB_PASSWORD, DB_HOST, DB_NAME. Make sure the values is same with mysql access

    2. If you use Dedicated server or VPS hosting, try to restart your mysql server by typing :

    -service mysql restart
    or
    -service mysql start

    if you use shared hosting, ignore this step

    I think, upgrade WP through FTP not solve this problem but you can try it

    Thread Starter knightgambit

    (@knightgambit)

    Whats odd is that it does connect every once in a while though.

    Going try to do the WP Database Repair seeif that helps

    If you got this error after having done ‘nothing’ to the site, then it most definitely is a database server issue that is host-related; don’t let them tell you anything else ??

    I had this exact thing happen to a number of sites on a certain host; all were working fine and then all of a sudden, your error. I had not touched the sites. Contacted the host and yep, they said they were aware of the situation and were having issues with the db servers and to just wait. Which I did. And sure enough, they were all back up within a short period of time.

    Thread Starter knightgambit

    (@knightgambit)

    So ironically it fixed itself…..didn’t have to do a thing. The problem was I got a massive influx in traffic from an article shared on Twitter

    So…

    The reasl question is how do I go about making sure this doesn’t happen again? Is it a host issue?

    Yes this is a host issue, you maybe have to upgrad your plan to handle more traffic.
    Check with you hosting company

    Thread Starter knightgambit

    (@knightgambit)

    You would think any hosting site could handle a couple thousand visitors? -_-

    Dion

    (@diondesigns)

    Um, no. ??

    A typical WordPress installation is fairly hard on a server. If one had a large number of simultaneous visitors to a WP site with a heavy theme and a lot of plugins, even some dedicated servers would have trouble handling the traffic.

    Having said this, you do have an issue with your hosting company. Bluehost is a brand name of EIG, and EIG does not have a stellar reputation. (Actually it has a horrible reputation.) Please give some thought to moving to a new hosting company. I’ve love to give you some suggestions, but the mods here will lock this topic the moment I (or anyone else) did so. You can get some new host suggestions on a site such as WebHostingTalk.

    Hi, in my experience when I have that issue and I’m certain that my database parameters are correct, I then just re apply the user privilegies on the database.

    In most of hosting panels, just go to the user section or properties screen and look if your user has all the privilegies set and save.

    ??

    I had this problem today. I’m no techie but this worked for me after much gnashing of teeth and midnight wailing! I had made FTP backups on my own computer of the WordPress installation and had a backup on the server of the database. My server management software is Plesk 12 and my root folder is /httpdocs, and I’m on a Webfusion VPS.

    You need to have: backup of files that were on the server. Backup of database and know which number it was (eg “wordpress_3”)

    Wipe server. Reinstall WP in /httpdocs making a note of the name of the database it is about to install.
    Reinstall theme in /wp-content/themes
    Reinstall index.php in /wp-content
    Reinstall uploads folder in /wp-content
    Reinstall all plugins ?in /wp-content/plugins
    Reinstall all files beginning “wp-” in /httpdocs
    Reinstall xmlrpc.php and index.php in /httpdocs
    Reinstall wp-includes folder in /httpdocs

    In Plesk, find recent backup of site by clicking on “Subscriptions” / mywebsite.com / backup manager / creation date of backup
    In Backup Content area select “Selected objects”. Choose “Database” from the Type of object to restore drop down list; select the database that appears in box below then click the blue box that appears to move it into box on right. Scroll down and click “Restore” Wait for it to do so.
    Now go to Server Management / Tools and settings / Database servers and click on the right hand tab to show all the databases on the server. Against the one just restored click “Manage hosting” Choose “Export dump” and save it to /httpdocs. Now choose “import dump” from the database assigned to the website (you made a note of this when you reinstalled WordPress) and import.

    Enter WordPress control panel through Plesk: Subscriptions / mywebsite.com / WordPress / Administrative interface (if you can’t get in go to “change settings and enter a new username and password). Once in, select your theme. Then go to Settings / General and enter your site title in the Site Title field. Go to Settings / Permalinks and choose “Post name” (or whatever your preference is).

    There may be easier ways to do this, but all I can tell you is that it worked. What I can’t tell you, and what makes me nervous of WordPress, is why the problem arose.

    I can’t get past this error message. I’m installing WordPress into an add-on domain at Hostgator. I’ve checked all the credentials – both with and without the prefix – in wp-config.php but it still keeps throwing up this error message.

    I’m not a programmer, nor a geek, so if you could phrase any response with that in mind, I’d be very grateful. I’m a retired teacher, with quite a bit of experience installing WP on a number of add-on domains, and have never had any problem installing. (It hurst, constantly banging your head against a brick wall!)

    Thanks.

    I am new to this forum. I am a Freelance Web and Graphic Designer, working with a client to create and new website to replace and outdated one. We chose to work with WordPress, due to its many plugins and ease of use after I turn it over. I have been receiving the “Error establishing database connection” message a lot here lately. When I contacted my hosting service they explained that the server is allocating all of the available memory, resulting in the OOM killer kills the MySQL to free memory. And when the server restarts I get the message. They suggested I contact a developer to optimize my applications. I am not a backend developer and I don’t know where to start optimizing, we don’t have that many plugins, 19 to be exact. We do have a lot of product images and gallery images, all have been optimized for size. Can anyone help me with this and point me in the right direction?

    cilo

    (@cilo)

    Hi ihave same problem with blue host.i optimize all database and data table, clear all plugin, and optimize web site but problem not solved.They suggest me to buy their site optimize tool($299) or buy vps hosting.
    Did you solve the problem?

    I’ve been having this problem sporadically and may have stumbled on an easy fix. If I just change the database password in wp-config.php and MySQL, that seems to fix the problem. It’s a pain, but at least it’s pretty quick.

    I’ve done this about half a dozen times. ISP is Netfirms. Interested to hear whether this works for anyone else.

    Best,
    Tony Lima
    Silicon Valley, CA

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Error Establishing a Database Connection’ is closed to new replies.