简体   繁体   English

Droplet 无法连接到外部 MySQL,在 Digital Ocean 中连接被拒绝

[英]Droplet cannot connect to external MySQL, Connection refused in Digital Ocean

I created a MySQL database and a Droplet on Digital Ocean, whenever I try to connect the Droplet to the DB using PHP or JS, I get the Connection refused error, but when accessing the DB on my localhost (using mysql workbench or php), I can normally.我在 Digital Ocean 上创建了一个 MySQL 数据库和一个 Droplet,每当我尝试使用 PHP 或 JS 将 Droplet 连接到数据库时,我都会收到 Connection refused 错误,但是在我的本地主机上访问数据库时(使用 Z81C3B080DAD5874BF55EZ 工作台),我可以正常。

What we know so far, apparently the Droplet does not have access to the external DB, since I can connect.到目前为止我们所知道的,显然 Droplet 无法访问外部数据库,因为我可以连接。

  • My db credentials are correct.我的数据库凭据是正确的。
  • The droplet was added to the DB's list of trusted sources, allowing remote access, so much so that my IP was also placed, so I can access it through localhost. droplet 被添加到数据库的可信源列表中,允许远程访问,以至于我的 IP 也被放置,所以我可以通过 localhost 访问它。

Does anyone have any idea what this Connection refused error might be?有谁知道这个 Connection denied 错误可能是什么? I've been trying to solve this problem for 2 days:(我已经尝试解决这个问题两天了:(

Guys I found out what it was, I installed a csf firewall and didn't add the database IP to the whitelist and solved the problem.伙计们,我发现了它是什么,我安装了一个 csf 防火墙并且没有将数据库 IP 添加到白名单并解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM