gpt4 book ai didi

php - 公共(public) IP 地址作为我在 mysql_connect() 中的主机名

转载 作者:行者123 更新时间:2023-11-29 00:18:21 25 4
gpt4 key购买 nike

我想连接我的 php 应用程序(在我办公室)和我家里的数据库,

mysql_connect('119.92.59.55','root','lester1992') 

但他们不相互通信(我的电脑和我的办公室终端),可能是什么问题?

这是我遇到的错误。

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.

提前致谢。

最佳答案

您需要在 mysql 中授予访问权限才能从远程主机访问。

GRANT ALL PRIVILEGES
ON database.*
TO 'user'@'your_office_ip_address'
IDENTIFIED BY 'newpassword';

关于php - 公共(public) IP 地址作为我在 mysql_connect() 中的主机名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22032892/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com