5

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
2
  • check if you are able to telnet to 127.0.0.1:3306
    – daya
    Jan 12, 2012 at 17:00
  • telnet connection fials
    – JannieT
    Jan 12, 2012 at 17:35

2 Answers 2

2

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.

1
  • 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, 2012 at 8:03
0

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

1
  • 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, 2012 at 17:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .