MySQL 错误:无法从您的 IP 地址获取主机名
我长时间使用远程 MySQL 数据库。
但是今天突然发现无法连接数据库。我有一个错误。
“无法从您的 IP 地址获取主机名”。
我没有更改 MySQL 设置中的任何内容。
有什么问题吗?
I use my remote MySQL database during long time.
But today I suddenly have found that I cannot connect to the database. I have got an error.
"Can't get hostname from your ip address".
I haven't changed anything in MySQL settings.
What's the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只需在
my.ini
或my.cnf
中添加以下内容即可。Linux:
否则,请使用以下标志启动 MySQL 服务器:
有关详细信息:http://dev.mysql.com/doc/refman/5.0/en/host-cache.html
Just add below in
my.ini
ormy.cnf
.Linux:
Otherwise, start MySQL server with the following flag:
For more information: http://dev.mysql.com/doc/refman/5.0/en/host-cache.html
我知道这个问题很久以前就被问过,大多数人现在已经弄清楚了,但是对于那些还没有弄清楚的人,这是我的解决方案:
在连接字符串中添加带有服务器名称的端口号
I know this question was asked quite some time ago and most people have figured it out by now, but for those who haven't, here was my solution:
Add the port number with the server name in you connection string
我在 Windows 上也收到同样的错误消息。我发现我的问题是本地服务器主机文件。检查 localhost 或您在文件 c:\windows\system32\drivers\etc\host 中使用的任何主机名
我的原始主机文件:
127.0.0.1 本地主机
::1 localhost
我只是删除第二行并仅使用第一行:
127.0.0.1 localhost
然后,问题解决了,对于我的问题。希望有帮助。
I've got the same error message on windows. I found my problem is the local server host file. Check the localhost or any hostname you use in the file c:\windows\system32\drivers\etc\host
My original host file:
127.0.0.1 localhost
::1 localhost
I just delete the second line and use the first line only:
127.0.0.1 localhost
Then, problem solved, for my problem. Hope it helps.
我在 Windows 10 机器上安装 MySQL 8 时遇到了这个问题。互联网上找到的大多数解决方案都设置了
skip-name-resolve
,但这对我来说从来没有用过。最后我发现这个对我有用:netsh Winsock Reset
然后重新启动计算机。 设置
127.0.0.1 localhost
。如果需要,还可以尝试在
%windir%\System32\drivers\etc\hosts
中I ran into this problem when installing MySQL 8 on a Windows 10 machine. Most of the solutions found on the internet are setting
skip-name-resolve
which never worked for me. At last I found out this one which worked for me:netsh winsock reset
Then reboot the computer. Also try set
127.0.0.1 localhost
in
%windir%\System32\drivers\etc\hosts
if needed.要解决此问题,可以通过更改计算机名称(
B2
为BBB
)来更改计算机主机名中的数值。To solve this problem, is by changing the name of the computer (
B2
toBBB
) which changes the numeric value from the Hostname of computer.