php 我的 SQL 错误:连接尝试失败,因为连接方没有正确响应
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6818104/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
My SQL Error: A connection attempt failed because the connected party did not properly respond
提问by Brahadeesh
I have a MySQL database in a 3rd party server. I am trying to access it from my local machine using php in dreamweaver. However, I am getting the following error:
我在第 3 方服务器中有一个 MySQL 数据库。我正在尝试使用 Dreamweaver 中的 php 从我的本地机器访问它。但是,我收到以下错误:
MySQL Error #2002:
A connection attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because connected host
failed to respond.
I realize I might not have given all the details. I am a beginner and will get the details if required. Thank you.
我意识到我可能没有提供所有细节。我是初学者,如果需要,我会得到详细信息。谢谢你。
采纳答案by Tom Squires
It means you cant connect to the server. Check your connecting to the correct ip address and your firewall is configured to allow traffic.
这意味着您无法连接到服务器。检查您连接到正确的 IP 地址,并且您的防火墙配置为允许流量。
回答by Venkat
If your using "localhost" also try host name as 127.0.0.1. If its server try from mysql terminal whether that host is connecting from your local machine.
如果您使用“localhost”,也可以尝试将主机名设为 127.0.0.1。如果它的服务器从 mysql 终端尝试该主机是否从您的本地机器连接。
In local machine I have faced same issue with host localhost and changed to 127.0.0.1 then its works well.
在本地机器上,我遇到了与主机 localhost 相同的问题并更改为 127.0.0.1 然后它运行良好。