This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / [菜鸟请教] 关于PHP中与MYSQL连接的问题PHP代码:
$link = @mysql_connect("127.0.0.1:2066", "root");
if ($link)
{
print ("Connected successfully");
mysql_close($link);
}
else
echo "Could not connect: " . mysql_error();
总是出现:
Could not connect: Can't connect to MySQL server on '127.0.0.1' (10061)
即使我把密码写在mysql_connect()中也是出现同样错误。
但是我在MYSQL命令行下连接数据库都没有问题。
请问,如何解决?
谢谢!
-polareskimo(Inuit);
2005-1-6
{425}
(#2059877@0)
-
i assume the port number is correct and the server does listening on the local loopback interface. is the host linux or ms, any firewall settings?
-buma(buma);
2005-1-6
(#2059929@0)
-
Thanks. the host is my computer with winXP and IIS5.1. No firewall here. I set windows firewall off.
-polareskimo(Inuit);
2005-1-6
(#2060806@0)
-
ran ur php script in command line mode? what's the result?
-buma(buma);
2005-1-6
(#2060895@0)
-
Ok, i worked it out. But, there are still questions. see details inside please.
-polareskimo(Inuit);
2005-1-6
{774}
(#2061088@0)