Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just upgraded from Windows XP to Windows 7 (64 bit)

I was using EasyPHP 5.3.1 to develop my website, but since I've upgraded I can't get PHP to talk to MySQL.

Even the PHPMyAdmin page doesn't load.

I've tried installing the latest 64bit version of MySQL in place of the supplied version of MySQL, but that hasn't helped.

The queries just don't seem to reach MySQL.

I have verified that the DB for my database works by running mysql on the command line.

PHPMyAdmin doesn't display an error, just a blank page.

The error coming up from my website is:

Warning: PDO::__construct() [pdo.--construct]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306) in E:\services\EasyPHP-5.3.1\www\IdeaWeb\classes\ on line 14

Fatal error: Maximum execution time of 60 seconds exceeded in E:\services\EasyPHP-5.3.1\www\IdeaWeb\classes\ on line 0

Does anyone know how to solve this? (i.e. get MySQL talking to PHP.)

share|improve this question
up vote 2 down vote accepted

OK. I didn't know this but and localhost are not the same thing on Windows 7.

I did some deeper Googling and found this thread. Basically it says in order to use localhost you need to set it up in the hostfile to point to

share|improve this answer

How are you referring to the SQL service? By local machine name, "localhost", a DNS name that points to the machine, an IP address associated with a physical interface on the machine,, ... ?

If you are talking to the SQL service by anything that could look remotely external then the most likelt culprit is the Windows firewall blocking the access. This is a good thing (the firewall should block things by default, only allowing connections in if explicitly told to do so), you just need to tell it to let your SQL connections. I've not used Windows 7 so I can't tell you exactly how to do this (things have no doubt moved around between versions) but it shouldn't be difficult. Also, if you are using an externl name/address as the hostname for connections, try using something explicitly local (localhost, instead.

As a temporary measure to prove that the firewall is what is stopping the connection before you dig in to make changes, turn it off completely for a minute and try again. If PHP->SQL qorks with the firewall off then your firewall config needs tweaking, if it still fails then the problem lies elsewhere.

share|improve this answer
Thanks for the idea. I have turned the firewall off, but I'm still getting the same result. MySQL is setup with default settings (for EasyPHP), and the connection is to localhost. – Matt Ellen Feb 20 '10 at 20:36

go to there

"control panel >> System and Security >> Windows Firewall >> Allowed Programs or ..."

ok now check these options :

  1. BranchCache - Content Retrieval ( user http)
  2. """"""""""" - Hosted Cache Client ( user https)
  3. """"""""""" - hosted cache server ( user https )
  4. """"""""""" - peer discovery ( user wsd )

enjoy :D

share|improve this answer

All you need to do is edit the following file if you have an admin rights


by uncommenting the line that says localhost 

Save and refresh your pages....

share|improve this answer

I had this problem.

This is what it should look like if you're having problems:

$connect = mysql_connect('','root','');

For more information on your MySQL database, right click the ePHP icon on your toolbar and click Admin... -> Then a new page should open and click manage mysql. Hope this helps.

share|improve this answer

protected by BinaryMisfit Oct 16 '10 at 6:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.