skip to Main Content

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.

2

Answers


  1. 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.

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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search