我有下面的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但是myserver.com的IP,当我在命令提示符下执行ping myserver.com时,它给出了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. 请帮我解决这个问题..。
提前谢谢..。
发布于 2014-05-19 09:40:21
在mysql服务器上:
mysql> use mysql;   
mysql> CREATE USER 'root'@'client_ipaddress' IDENTIFIED BY 'redhat';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'client_ipaddress' WITH GRANT OPTION;https://stackoverflow.com/questions/23733626
复制相似问题