mysql系统错误 111_与MySQL服务器的连接断开,系统错误:111

bd96500e110b49cbb3cd949968f18be7.png

When I try to connect to my databases, I get this error:

Lost connection to MySQL server at 'reading initial communication packet', system error:111

Here is my PHP code (it's just a test):

@session_start();

include(".conf.php");

print_r($conf);

$con = mysql_connect($conf['db_hostname'], $conf['db_username'], $conf['db_password']) or die (mysql_error());

mysql_select_db("aTableName", $con);

$prof = '000';

//$prof = $_GET['profile'];

$prof = addslashes(htmlentities($prof));

$result = "SELECT * FROM aTableName WHERE id = '$prof'";

$q = mysql_query($result, $con);

$qarr = mysql_fetch_array($q);

print_r($qarr);

?>

Any help would be appreciated. I can't figure it out and it's really bugging me. Thank you!

EDIT: I am hosting on GoDaddy, hosting and databases.

解决方案

Your host is wrong, your port is wrong, a firewall blocked the connection, or the SQL server is not running. 111 is "connection refused". You can troubleshoot by trying to telnet to the SQL server's host and port. If that works, your code gets the host or port wrong.

If that doesn't work, check on the SQL server itself. If it works there, the problem is the network. If it doesn't work there, the SQL server is not running.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值