失去与MySQL服务器的连接,系统错误:111 [英] Lost connection to MySQL server, system error: 111
问题描述
当我尝试连接到数据库时,出现此错误:
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
这是我的PHP代码(仅是测试):
Here is my PHP code (it's just a test):
<?php
@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!
我正在GoDaddy上托管,托管和数据库.
I am hosting on GoDaddy, hosting and databases.
推荐答案
您的主机错误,端口错误,防火墙阻止了连接或SQL Server未运行. 111是连接被拒绝".您可以尝试通过telnet
到SQL Server的主机和端口进行故障排除.如果可行,则您的代码会使主机或端口错误.
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.
如果这不起作用,请检查SQL Server本身.如果在那里工作,则问题出在网络上.如果无法正常运行,则表明SQL Server未运行.
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.
这篇关于失去与MySQL服务器的连接,系统错误:111的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!