Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 command

mysql -h xx.xx.xx.xx --port=3306 -u root -p

I get error as:

ERROR 1042 (HY000): Can't get hostname for your address

Have tried putting entry of client ip in server's etc\hosts file as

<client-ip>  <client-hostname>
  • Server: MySQL ver 5.5
  • OS: Windows XP
share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
+1 The 2nd option worked.. – M.N Aug 25 '10 at 12:14
@Link down.............. – Pacerier Jan 14 '15 at 10:19

This seems to be a reported bug in MySQL ver5.5. It was resolved using the following option in [server] section of my.ini file


It disables the DNS lookup by MySQL for connecting peers.

The only thing to keep in mind is: this case, you can use only IP numbers in the MySQL grant tables.

share|improve this answer
Link down............ – Pacerier Jan 14 '15 at 10:19

I was facing same issue,i was tring to connect to remnote mysql server using my window 7 os machine but in my case disabling firewall solved my problem

share|improve this answer

Your Answer


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.