php MySQL 服务器在“读取初始通信数据包”,系统错误:111
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11168945/
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
MySQL server at 'reading initial communication packet', system error: 111
提问by Tina
I moved my site to godaddy server, but the SQL connection is not working even with adequate changes which was working perfectly fine before
我将我的站点移到了godaddy 服务器,但是即使进行了足够的更改,SQL 连接也无法正常工作,而这之前运行良好
<?php
$link = mysql_connect('www.xxxxx.com', 'phpadminusername', 'phpadminpasswor');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
/*echo 'Connected successfully';*/
echo "DB CONNECTION :<font color='green'>ACTIVE</font>";
?>
It is showing an error
它显示错误
Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /home/content/58/9508458/html/psychiatric/private.php on line 196 Could not connect: Lost connection to MySQL server at 'reading initial communication packet', system error: 111
警告:mysql_connect() [function.mysql-connect]:在“读取初始通信数据包”时失去与 MySQL 服务器的连接,系统错误:111 in /home/content/58/9508458/html/psychiatric/private.php on line 196无法连接:在“读取初始通信数据包”时丢失与 MySQL 服务器的连接,系统错误:111
回答by Tina
fixed by updating to hostname in account manager specifically given by godaddy.com .. not just the domain name
通过更新到由godaddy.com 专门提供的帐户管理器中的主机名来修复.. 不仅仅是域名
回答by Robbie
That probably means mySQL is configured to only listed to requests from a particular hosts (or hosts). You can tell MySQL to only accept packets from particular IP addresses (usually localhost, but it may be wider on GoDaddy - not sure as I don't use them).
这可能意味着 mySQL 被配置为仅列出来自特定主机(或多个主机)的请求。您可以告诉 MySQL 只接受来自特定 IP 地址的数据包(通常是本地主机,但在 GoDaddy 上可能更宽 - 不确定,因为我不使用它们)。
Check your connection string - specifically the 'www.xxxxx.com' bit. This might need to be 'localhost' or a specific IP address.
检查您的连接字符串 - 特别是“www.xxxxx.com”位。这可能需要是“本地主机”或特定的 IP 地址。

