mysql host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

The same ip generates too many (more than the maximum value of max_connection_errors of the mysql database, the default value of the current version is very small, and can be modified to a larger size) in a short period of time. Blocking caused by interrupted database connections;

Solution:

1. Increase the number of max_connection_errors allowed (to cure the symptoms but not the root cause):

  ① Enter the Mysql database to view max_connection_errors:  show variables like '%max_connection_errors%';

    ② Modify the number of max_connection_errors to 1000:  set global max_connect_errors = 1000;

  ③ Check whether the modification is successful: show variables like '%max_connection_errors%';

2. Use the mysqladmin flush-hosts  command to clean up the hosts file (do not know which directory mysqladmin is in, you can use the command to find: whereis mysqladmin );

  ① Use the command to modify in the found directory: /usr/bin/ mysqladmin flush-hosts -h192.168.1.1  -P3308  -uroot  -prootpwd;

  Remark:

    The port number, user name, and password can be added and modified as needed;

    If the master/slave master-slave database is configured, both the master library and the slave library should be modified again (I just ate the result of a few commands that were easy to lose for most of the day);

    It can also be done in the database, the command is as follows: flush hosts;

Reprinted in: https://www.cnblogs.com/yxfcnbg/p/11526324.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324776313&siteId=291194637