mysql_connect() 未到达正确的服务器
我有一个与本地服务器有全局开放的 mysql 连接的系统。在我的一个文件中,我打开了与远程计算机的附加连接。
我没有尝试连接到该机器,而是从 ISP 收到一条拒绝访问的消息(它似乎正在尝试连接到该机器上的数据库)。
我正在尝试使用以下方式进行连接:
$cust_conn = mysql_connect($host,'root','##password##');
我已尝试 subdomain.domain.com:3306
code>、subdomain.domain.com
和 ip:3306
作为 $host
的值。
奇怪的是,这是我得到的回应:
Warning: mysql_connect(): Access denied for user 'root'@'my.isp.com' (using password: YES) in /var/www/html/report/module/sql_view.php on line 19 Error: Could not connect to database:
有什么想法为什么会发生这种情况吗?似乎由于某种原因,我的脚本正在尝试连接到我的 ISP 服务器,而不是传入 $host
的服务器。
I have a system with a globally open mysql connection to the local server. In one of my files I am opening an additional connection to a remote machine.
Wieldly instead of trying to connect to that machine, I get an access denied message from my ISP (it seems to be trying to connect to the database on that machine).
I am trying to connect using:
$cust_conn = mysql_connect($host,'root','##password##');
I have tried subdomain.domain.com:3306
, subdomain.domain.com
and ip:3306
as the value for $host
.
The wierd this is the response i get:
Warning: mysql_connect(): Access denied for user 'root'@'my.isp.com' (using password: YES) in /var/www/html/report/module/sql_view.php on line 19 Error: Could not connect to database:
Any ideas why this would happen? It seems like for some reason my script is attempting to connect to my ISPs server, instead of the one passed in $host
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误消息中给出的主机是它尝试连接的主机,而不是目标主机。
The host given in the error message is the host it's trying to connect from, not to.
错误中的主机名 (my.isp.com) 是您客户端的主机...远程 root 访问通常被禁用,或者 pass/host 组合
添加凭据时可能是错误的:
http://dev.mysql.com/doc/refman/5.1/en/adding-users.html< /a>
that hostname in the error (my.isp.com) is your client's host...remote root access is often disabled, or perhaps the pass/host combo is wrong
to add the creds:
http://dev.mysql.com/doc/refman/5.1/en/adding-users.html