Solved

"Error establishing a database connection" on websites using mysql database

Posted on 2013-01-10
4
518 Views
Last Modified: 2013-01-21
All wordpress sites on my server were working fine until I received an email from google saying that it's bots couldn't crawl one or two of the site.   (that a owner didn't pick the issue up first is amazing, but anyway...)
When I try to access a site there is a message "Error establishing a database connection".

On the server, when I try to use phpMyAdmin to see what is going on there is a error connecting to localhost.

After much stuffing about, I can now log into PMA, can see the databases and their data, can see the user accounts that each site should be connecting with yet still have the aforementioned error.

How can I fix this?

FYI:
Windows Server 2008 R2 Standard (IIS 7.5)
MySQL 5.1.66
PHP 5.4
0
Comment
Question by:Reece Dodds
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 38766076
I get emails like that from Google now and then.  By themselves, they don't mean much and they certainly can't cause the problem.  

Did an IP address change somewhere?  Are you connecting to 'localhost' using PMA?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 38766083
I did have a problem like that on Godaddy last year.  For a day, their internal DNS went down and the databases were being selected by name.  I changed it over to the IP address and the problem went away.  A few million web sites were pissed at Godaddy for a while for that.
0
 
LVL 7

Accepted Solution

by:
Reece Dodds earned 0 total points
ID: 38784883
something happened to the main database...   It seemed to have lost all of the passwords assigned to the users.  And had lost which users connected to which database.

So all of the connection settings that each wordpress site had it their wp-config.php files was useless.

I added the users, permissions and then changed the passwords for each.
Restarted the server and all is good again.

Not sure how or why this happened, but I've changed the security settings for  MySQL, server remote access and FTP access just in case.
0
 
LVL 7

Author Closing Comment

by:Reece Dodds
ID: 38800534
self resolved.

Thanks to the members who contributed though.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now