Solved

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

Posted on 2013-01-10
4
523 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 83

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 83

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

864 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

22 Experts available now in Live!

Get 1:1 Help Now