Windows – bind-address = ::1 # however, netstat shows 0.0.0.0:3306 LISTENING

ipv6MySQLnetstatwindows 7

I'm running MySQL 5.6 on 64-bit Windows 7 with IPv6 and IPv4 enabled.

In my.ini:

port=3306
bind-address = ::1

I was hoping to use IPv6 and restrict to the loop-back adapter. I used ::1 instead of 127.0.0.1 because win7 with IPv6 defaults to ::1 for localhost.

With this configuration netstat reports the following:

C:\>netstat -an |findstr 3306
  TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
  TCP    [::1]:3306             [::]:0                 LISTENING

It seems like connections may be getting blocked on the IPv4 interface, but seeing netstat report that 0.0.0.0 port 3306 is open makes me uneasy.

The MySQL documentation specifies:

If the address is a “regular” IPv4 or IPv6 address (such as 127.0.0.1
or ::1), the server accepts TCP/IP connections only for that IPv4 or
IPv6 address.

TCPView gave me the same info as netstat. I couldn't get TDIMon working on my system.

How can I prevent mysql from listening on 0.0.0.0?

Best Answer

I see two possibilities here:

  1. You actually have two copies of MySQL running, one of which bound to IPv4, and the other which bound to IPv6. This is probably not very likely, but it's something you should check for anyway.

  2. You've found a bug in the Windows port of MySQL. When I tried this on Linux, bind-address = ::1 caused MySQL to bind only to ::1 and not to any IPv4 addresses. In this case you should report it as a bug to MySQL.

Related Question