提供特定IP地址导致数据库连接错误-Drupal
我已经创建了数据库和用户,并将所有权限授予该用户。当我将 IP 指定为数据库主机时。它将显示以下错误。将主机名指定为 localhost 它将正常工作。
我正在使用 phpmyadmin 3.3.2...
错误消息如下。
无法连接到您的 MySQL 数据库服务器。 MySQL 报告以下消息:无法连接到“192.168.85.10”上的 MySQL 服务器 (111)
I have created database and user and give all the privilege to the user.When i give the IP as Database host.It will show the following errors.Giving hostname as localhost it will work fine.
I am using phpmyadmin 3.3.2...
The error message is given below.
Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to MySQL server on '192.168.85.10' (111)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您使用的IP地址是您的“外部”IP,而不是本地主机将解析的IP地址,这在大多数情况下是您的环回:127.0.0.1。
因此,如果您尝试从运行数据库的同一台计算机进行连接,则应使用 127.0.0.1 作为 IP 地址。
如果您尝试从网络上的另一台计算机连接到数据库,则应在 my.conf(MySQL 配置文件)中启用 MySQL 远程访问。因为默认情况下 MySQL 禁用远程传入连接。
您可以通过将“bind-address”行设置为您的真实(外部)服务器 IP 来完成此操作:
或者将绑定地址放在注释中。
还要确保跳过网络选项注释如下:
然后重新启动 MySQL 服务器。
现在还要确保您的 MySQL 用户也可以从“@localhost”以外的位置进行连接。
我希望这有帮助!
干杯,
蒂木桑
It seems that the IP address you use is your "external" IP and not the IP localhost would resolve to, which is most of the time your loopback: 127.0.0.1.
So if you are trying to connect from the same computer as the database is running you should use 127.0.0.1 as the IP address.
If you are trying to connect to your database from another computer on the network, you should enable MySQL remote access in your my.conf (MySQL config file). Because by default MySQL disables remote incoming connections.
You do this by setting the "bind-address" line to your real (external) server IP as such:
Or put the bind-address in comment.
Also make sure that the skip-networking option is commented as such:
And then restart your MySQL server.
Now also make sure that your MySQL users are also allowed to connect from locations other then "@localhost".
I hope this helps!
Cheers,
Timusan