为什么我必须运行“冲洗主机”;我项目的每一天

发布于 2025-02-05 05:41:37 字数 238 浏览 7 评论 0原文

我有一个在数字海洋上托管的LEMP堆栈项目。这显示

Host '167.71.227.200' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

我每天使用flush主机;否则会给我同样的错误。 我该怎么做才能永久解决它。 我不喜欢数字主机和OPS。

I have a LEMP stack project that is hosted on digital ocean. that shows error

Host '167.71.227.200' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

every day i use FLUSH HOSTS; otherwise it give me same error.
what should i do to solve it permanently.
i'm not to digital host and ops in general.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恍梦境° 2025-02-12 05:41:38

您忘记关闭应用程序中的数据库连接。
使用Conn.Close()确保每个查询后连接关闭

You are forgetting to close the database connection in your application.
Use conn.close() to ensure the connection is closed after each query

柠栀 2025-02-12 05:41:37

这可能是因为当客户端尝试连接到MySQL Server时,您经常出现错误。参见 https://dev.mysql.com /Doc/refman/8.0/en/host-cache.html#blocked-host

max_connect_errors失败的请求而没有成功
连接,服务器假设有问题(例如,
有人试图闯入),并阻止主机进一步
连接请求。

要解开阻止的主机,冲洗主机缓存。

很容易增加max_connect_errors的值,但这只会稍微延迟问题。您的服务器看到很多错误的事实可能表明了您需要以另一种方式解决的根本原因。

例如,这可能是由客户端和MySQL Server之间的不稳定网络引起的,因此连接尝试经常失败。您应该提高网络可靠性,否则将客户端转移到具有更稳定网络的主机。

这可能不是代码问题,而是基础架构问题。

This is likely because you have frequent errors when clients try to connect to your MySQL Server. See https://dev.mysql.com/doc/refman/8.0/en/host-cache.html#blocked-host

After max_connect_errors failed requests without a successful
connection, the server assumes that something is wrong (for example,
that someone is trying to break in), and blocks the host from further
connection requests.

To unblock blocked hosts, flush the host cache.

It's tempting to increase the value of max_connect_errors, but that will only delay the problem slightly. The fact that your server is seeing so many errors probably indicates a root cause that you need to address another way.

For example, this could be caused by an unstable network between the client and the MySQL Server, so connection attempts frequently fail. You should improve the network reliability, or else move the client to a host that has a more stable network.

This is likely not a code problem, but an infrastructure problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文