I have MySQL 5.5 Server setup on a Windows machine.
I am able to connect to the server from console / app running on the same machine but not from a remote machine. While connecting using the following command:
mysql -h xx.xx.xx.xx --port=3306 -u root -p
I get the following error:
ERROR 1042 (HY000): Can't get hostname for your address
I have tried putting the entry of client IP in server's %windir%\system32\drivers\etc\hosts
file as:
<client-ip> <client-hostname>
- Server: MySQL 5.5
- OS: Windows XP
I believe this is to do with the fact that MySQL tries to establish the DNS name associated with your IP address on connect. See here for more information at the MySQL site.
You have two options:
1) Fix the connecting machine's reverse DNS. Since you've already added the machine to the hosts file, this might be unnecessary. You should also issue a FLUSH HOSTS statement on the MySQL server. See the same link above for more information about this.
2) Run MySQL with the '--skip-name-resolve' option. However, if you do this, you won't be able to use DNS names in GRANT statements. Instead you'll be restricted to using IP addresses.
2.1) or put in my.ini :
I'd recommend (1) if you can.
Hope this helps.
This seems to be a reported bug in MySQL ver5.5. It was resolved using the following option in [server] section of
my.ini
fileIt disables the DNS lookup by MySQL for connecting peers.
The only thing to keep in mind is:
I had the same issue but on Windows 7. Disabling the Windows Firewall worked for me.