php 读取问候包时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18803440/
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
Error while reading greeting packet
提问by BinaryMan
i have problem ... im tring to connect to server in netbeans .... I write the code as bellow:
我有问题......我正在尝试连接到netbeans中的服务器......我将代码编写如下:
<?php
echo "wlecome";
echo "<br>";
$conn=mysqli_connect("mydomain.com:2082", "phpmyadmin_user", "password","database_name");
echo $conn;
?>
runing of this code return this erreurs:
运行此代码会返回此错误:
wlecome
Warning: mysqli_connect(): MySQL server has gone away in C:\xampp\htdocs\myprojet\index.php on line 10
Warning: mysqli_connect(): Error while reading greeting packet. PID=1092 in C:\xampp\htdocs\myprojet\index.php on line 10
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in C:\xampp\htdocs\myprojet\index.php on line 10
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\myprojet\index.php on line 10
I googled a lot, but either I used the wrong keywords or there are no simple solutions on the internet. I hope somebody here can help me.
我用谷歌搜索了很多,但要么我使用了错误的关键字,要么互联网上没有简单的解决方案。我希望这里有人可以帮助我。
Best regards and thanks in advance, Fadel.
最好的问候并提前致谢,法德尔。
回答by TravisO
MySQL can be configured to not accept external connections, for security reasons. By saying the full domain name, you are using the public IP and therefore you are an external connection. If MySQL is running on the same box as your webserver, just access it via this domain name:
出于安全原因,MySQL 可以配置为不接受外部连接。通过说出完整的域名,您使用的是公共 IP,因此您是一个外部连接。如果 MySQL 与您的网络服务器在同一台机器上运行,只需通过以下域名访问它:
localhost:2082