- 论坛徽章:
- 0
|
0 down vote favorite
1
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
mysql etc-hosts
link|edit|flag
edited Aug 31 '10 at 19:44
jscott
5,96911021
asked Aug 25 '10 at 7:54
Mohit Nanda
162212
63% accept rate
2 Answers
active oldest votes
up vote 1 down vote accepted
Hi there, 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 :
[mysqld]
skip-name-resolve
I'd recommend (1) if you can.
Hope this helps.
link|edit|flag
edited Feb 17 at 13:00
Community♦
170147
answered Aug 25 '10 at 8:36
grw
285
+1 The 2nd option worked.. – Mohit Nanda Aug 25 '10 at 12:14
up vote 0 down vote
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
skip-name-resolve
It disables the DNS lookup by MySQL for connecting peers.
The only thing to keep in mind is:
...in this case, you can use only IP numbers in the MySQL grant tables.
[mysqld]
skip-name-resolve
# The TCP/IP Port the MySQL Server will listen on
port=3306
问题解决 |
|