os: centos 7.4
db: mysql 8.0
登录 mysql 服务端口是,提示如下错误:
# telnet 192.168.56.60 3306
Trying 192.168.56.60...
Connected to 192.168.56.60.
Escape character is '^]'.
kHost '192.168.56.61' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.
提示在 目标mysql 主机上执行如下命令,然后就可以连了。
# mysqladmin flush-hosts
官网查了下是受 max_connect_errors 的影响
mysql> show global variables like '%max_connect_errors%';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| max_connect_errors | 100 |
+--------------------+-------+
1 row in set (0.01 sec)
调大这个值
SET GLOBAL max_connect_errors=10000;
同时修改参数文件
[mysqld]
max_connect_errors=10000
参考:
https://dev.mysql.com/doc/refman/8.0/en/blocked-host.html