Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS redirect 1 67
ebay devID, appID, certID, userToken 2 25
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 32
Cookie not unsetting 7 18
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

775 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