MySQL服务器在PHP中消失了

时间:2014-04-06 10:49:32

标签: php mysql mysqli

$mysqli = new mysqli("127.0.0.1:30", "root", "");
if ($mysqli->connect_errno)
{
    echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->
        connect_error;
    exit("..............");
}

此代码执行时间很长,最后会显示MySQL Server has gone away

Apache Port30

MySQL server端口为3306

使用Microsoft Windows 8.1

1 个答案:

答案 0 :(得分:0)

您也可以使用此

  $mysqli = new mysqli("127.0.0.1", "root", "");
  

mysqli.default_port = 3306

这将默认通过3306端口连接。

检查this