views:

641

answers:

4

Problem

Users from other IPs on the (Windows XP) LAN suddenly cannot connect to my local MySQL server.

Background

I've set up MySQL on my local Windows computer so that other computers on the network have access to the root account. I've added each IP as a host for root. Up to some weeks ago, things worked flawlessly and I could connect to the server programatically and using various MySQL admin tools. Now, however, the MySQL server simply refuses connections from those IPs and I can't figure out why.

The network changes that I've done are: changing network card for two (of three) computers and fiddled around with MySQL settings. None of which should have caused this problem. I've tried adding a new user with all relevant hosts, but I get the same type of error:

MySQL Error number 1045 Access denied for user 'root'@'shop' (using passwords: YES)

The odd part is that the computer name, 'shop', is used instead of the IP. I don't know why.

A: 

Could you have turned off TCP connections in MySQL?

Also, is the MySQL port open in your firewall?

Can Berk Güder
Turned off TCP connections? I don't recall touching settings related to that. The post is open but I've even disabled the firewall on the MySQL server.
AquinasTub
+1  A: 

First thing that pops into mind is Windows Firewall, which could have got re-enabled if you swapped NICs on the host computer.

My next suggestion would be to use a sniffer like Wireshark on the host computer and see what exactly happens packet-wise. You can use filters to make to reduce the output - they're very simple and easy to use. This tool has saved me countless hours of debugging.

-EDIT-

Another possible cause might be that your server somehow decided to resolve IPs to hostnames, in which case ip addresses may no longer work - one would need to add hostnames to the allowed list. Not sure if it works this way for MySQL though.

frgtn
Windows firewall isn't enabled. I'm using another software firewall but that's completely disabled.Thanks for suggesting Wireshark. I feel I need to add that the clients are able to connect to the server but that access is denied for them.
AquinasTub
You we're sorta right! I've already added each computer's name as host but written them in uppercase instead of proper capitalization - thought mysql treated host names case-insensitive.
AquinasTub
+2  A: 

Somehow, IPs seem to be resolved now and hostnames are used. Did you grant access to root@shop? Did you flush privileges?

Pascal Thivent
yes, I've added both names and IPs for each computer. But I haven't flushed priviligies. Thanks for the tip!
AquinasTub
That was more than a tip. That was the answer :)
Pascal Thivent
A: 

If you changed your IP (DHCP?), make sure to correct it in my.cnf if you bound mysqld to your lan ip:

[mysqld]
...
bind-address=192.168.x.y
Karsten