【发布时间】:2014-07-07 04:05:00
【问题描述】:
我有以下 php 代码可以连接到我的 mysql 数据库。
mysql_connect( "myserver.com" , "root", "redhat","datastore") or die(mysql_error());
当我运行此代码时,我收到错误消息:
Warning: mysql_connect(): Host '10.21.21.10' is not allowed to connect to this MySQL server in C:\xampp\htdocs\inventory\net.php on line 20
Host '10.21.21.10' is not allowed to connect to this MySQL server
但是当我在命令提示符中 ping myserver.com 时,myserver.com 的 IP 为 10.25.15.95
,所以我将代码修改为:
mysql_connect( "10.21.21.10" , "root", "redhat","datastore") or die(mysql_error());
同样的错误重复了。
然后我将代码更改为:
mysql_connect( "10.25.15.95" , "root", "redhat","datastore") or die(mysql_error());
错误是
Warning: mysql_connect(): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\inventory\net.php on line 20
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
请帮我解决这个问题..
提前谢谢...
【问题讨论】:
-
您的远程服务器不允许您的 ip 连接。请联系您的托管服务提供商。
标签: php mysql mysql-connect