Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

With WAMP 2.2 serving Apache 2.2.21, MySQL 5.5.16 and PHP 5.3.8 on my Windows XP development machine, I can connect and manage my database via phpMyAdmin or any locally hosted PHP script using a DNS like "mysql:host=localhost;dbname=kwamjing"

When I try to connect to MySQL via a management tool like HeidiSQL or MySQL Query Browser I get

Error 2003 Can't connect to MySQL server on 'localhost' (10061)

Can a firewall block HeidiSQL from accessing 127.0.0.1:3306 but not PHP?

UPDATE:

Looking at my active connections through netstat -an I see only the ipv6 loopback listening on 3306

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:2869           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:80           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:1025         0.0.0.0:0              LISTENING
  TCP    127.0.0.1:2215         127.0.0.1:2216         ESTABLISHED
  TCP    127.0.0.1:2216         127.0.0.1:2215         ESTABLISHED
  TCP    127.0.0.1:2217         127.0.0.1:2218         ESTABLISHED
  TCP    127.0.0.1:2218         127.0.0.1:2217         ESTABLISHED
  TCP    127.0.0.1:5152         0.0.0.0:0              LISTENING
  TCP    192.168.0.103:139      0.0.0.0:0              LISTENING
  TCP    192.168.0.103:2869     192.168.0.1:4530       CLOSE_WAIT
  TCP    192.168.0.103:2869     192.168.0.1:4532       CLOSE_WAIT
  TCP    [::]:135               [::]:0                 LISTENING       0
  TCP    [::]:2869              [::]:0                 LISTENING       0
  TCP    [::]:3306              [::]:0                 LISTENING       0
share|improve this question
    
check if you are able to telnet to 127.0.0.1:3306 –  daya Jan 12 '12 at 17:00
    
telnet connection fials –  JannieT Jan 12 '12 at 17:35

2 Answers 2

up vote 2 down vote accepted

As you are only listening on ipv6, php must have figured this out and is making an ipv6 connection.

HeidiSQL perhaps doesn't support ipv6 and is attempting to connect to mysql on ipv4 and is failing. If you change your bind-address in the my.cnf mysqld section to

bind-address=127.0.0.1

it should fix it.

share|improve this answer
    
Brilliant! That was it. Just for reference. I put bind-address=127.0.0.1 under [mysqld] in my my.ini file –  JannieT Jan 13 '12 at 8:03
    
Thanks, I updated the answer to fix the typo. –  Paul Jan 13 '12 at 8:32

Yes, check your Windows Firewall, make sure it's not blocking your management tool's access.

share|improve this answer
    
Didn't realise that the internal loopback address goes through the firewall. Anyway, I've given HeidiSQL full access through the firewall and still can't connect. –  JannieT Jan 12 '12 at 17:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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