澳门在线威尼斯官方 > 电脑数据库 > 威尼斯澳门在线:MySQL参数max_connect_errors剖判解释

原标题:威尼斯澳门在线:MySQL参数max_connect_errors剖判解释

浏览次数:167 时间:2019-10-13

 

 

关于MySQL的状态变量Aborted_clients & Aborted_connects分别代表的意义,以及哪些情况或因素会导致这些状态变量变化呢?下文通过实验测试来验证一下,首先我们来看看状态变量的描述:

最近一MySQL服务器,由于一些特殊因素遇到“ERROR 1129 (00000): Host 'xxx' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'”,在问题解决后,在详细了解参数max_connect_errors的过程中,有些不同网络资料的矛盾描述确实让我有点迷惑和混淆(关于这个错误,本质原因是因为同一个IP在短时间内产生太多中断的数据库连接(超过max_connect_errors的最大值)而导致的),下面介绍我的探索问题、分析问题、释疑的一个过程。

 

 

 

首先,我在网上搜索了一些资料,不少资料信誓旦旦的介绍,密码输入错误的尝试次数超过max_connect_errors变量,MySQL就会阻塞这个客户端登录,然后我找到了官方资料关于max_connect_errors的介绍,如下所示,MySQL 5.6/5.7的介绍一致

Aborted Connect

 

 

 

Aborted Connect表示尝试连接到MySQL服务器失败的次数。这个状态变量可以结合host_cache表和其错误日志一起来分析问题。 引起这个状态变量激增的原因如下:

If more than this many successive connection requests from a host are interrupted without a successful connection, the server blocks that host from further connections. You can unblock blocked hosts by flushing the host cache. To do so, issue a FLUSH HOSTS statement or execute a mysqladmin flush-hosts command. If a connection is established successfully within fewer than max_connect_errors attempts after a previous connection was interrupted, the error count for the host is cleared to zero. However, once a host is blocked, flushing the host cache is the only way to unblock it. The default is 100.

 

 

 

如上所示,翻译出来的话,大致如下:如果MySQL服务器连续接收到了来自于同一个主机的请求,而且这些连续的请求全部都没有成功的建立连接就被中断了,当这些连续的请求的累计值大于max_connect_errors的设定值时,MySQL服务器就会阻止这台主机后续的所有请求。相信一开始你看到这些资料,也会被“many successive connection requests from a host are interrupted without a successful connection”给弄懵,其实这个就是因为由于网络异常而中止数据库连接。网上搜索到这么一个资料:

    1、 客户端没有权限但是尝试访问MySQL数据库。

 

 

There seems to be confusion around that variable. It does not really block hosts for repeated invalid passwords but for aborted connections due to network errors.

    2、 客户端输入的密码有误。

 

 

 

    3、 A connection packet does not contain the right information.

 

 

好吧,那么我们自己动手实验验证一下,就能弄明白到底那个是正确的。在MySQL数据库里面创建一个test账号,然后我们将max_connect_errors变量设置为3.

   4、 超过连接时间限制,主要是这个系统变量connect_timeout控制(mysql默认是10s,基本上,除非网络环境极端不好,一般不会超时。)

 

 

 

官方解释如下:

 

 

mysql> show variables like '%max_connect_errors%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 100   |

+--------------------+-------+

1 row in set (0.00 sec)

 

mysql> set global max_connect_errors=3;

Query OK, 0 rows affected (0.00 sec)

 

mysql> show variables like '%max_connect_error%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 3     |

+--------------------+-------+

1 row in set (0.00 sec)

 

 

If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connection attempts can occur for the following reasons:

 

 

 

·         A client attempts to access a database but has no privileges for it.

然后我们在另外一台测试机器,以错误的密码去连接这个MySQL数据库,如下所示,即使前面输入了三次错误密码,第四次输入是也没有碰到上面错误。那么可以排除这个变量与密码错误输入有关系。

 

 

·         A client uses an incorrect password.

 

 

[root@mytestlnx02 tmp]# mysql -h10.20.57.24 -utest -p

·         A connection packet does not contain the right information.

Enter password:

 

ERROR 1045 (28000): Access denied for user 'test'@'mytestlnx02' (using password: YES)

·         It takes more than connect_timeout seconds to obtain a connect packet. See Section 5.1.7, “Server System Variables”.

[root@mytestlnx02 tmp]# mysql -h10.20.57.24 -utest -p

 

Enter password:

 

ERROR 1045 (28000): Access denied for user 'test'@'mytestlnx02' (using password: YES)

 

[root@mytestlnx02 tmp]# mysql -h10.20.57.24 -utest -p

 

Enter password:

 

ERROR 1045 (28000): Access denied for user 'test'@'mytestlnx02' (using password: YES)

 

[root@mytestlnx02 tmp]# mysql -h10.20.57.24 -utest -p

Aborted Clients:

Enter password:

** 

ERROR 1045 (28000): Access denied for user 'test'@'mytestlnx02' (using password: YES)

 

[root@mytestlnx02 tmp]#

Aborted Clients表示由于客户端没有正确关闭连接而中止的连接数。官方解释如下:

 

  

 

   The number of connections that were aborted because the client died without closing the connection properly. See Section B.5.2.10, “Communication Errors and Aborted Connections”

其实,关于某个IP输入了错误密码,MySQL会在performance_schema数据库下的host_cache表中记录。它会累计记录在COUNT_AUTHENTICATION_ERRORS字段,如下所示:

 

 

 

 

当Aborted Clients增大的时候意味着有客户端成功建立连接,但是由于某些原因断开连接或者被终止了,这种情况一般发生在网络不稳定的环境中。主要的可能性有:

mysql> use performance_schema;

Database changed

mysql> select * from host_cacheG;

*************************** 1. row ***************************

                                        IP: 192.168.27.180

                                      HOST: gettestlnx02

                            HOST_VALIDATED: YES

                        SUM_CONNECT_ERRORS: 0

                 COUNT_HOST_BLOCKED_ERRORS: 0

           COUNT_NAMEINFO_TRANSIENT_ERRORS: 0

           COUNT_NAMEINFO_PERMANENT_ERRORS: 0

                       COUNT_FORMAT_ERRORS: 0

           COUNT_ADDRINFO_TRANSIENT_ERRORS: 0

           COUNT_ADDRINFO_PERMANENT_ERRORS: 0

                       COUNT_FCRDNS_ERRORS: 0

                     COUNT_HOST_ACL_ERRORS: 0

               COUNT_NO_AUTH_PLUGIN_ERRORS: 0

                  COUNT_AUTH_PLUGIN_ERRORS: 0

                    COUNT_HANDSHAKE_ERRORS: 0

                   COUNT_PROXY_USER_ERRORS: 0

               COUNT_PROXY_USER_ACL_ERRORS: 0

               COUNT_AUTHENTICATION_ERRORS: 4

                          COUNT_SSL_ERRORS: 0

         COUNT_MAX_USER_CONNECTIONS_ERRORS: 0

COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS: 0

             COUNT_DEFAULT_DATABASE_ERRORS: 0

                 COUNT_INIT_CONNECT_ERRORS: 0

                        COUNT_LOCAL_ERRORS: 0

                      COUNT_UNKNOWN_ERRORS: 0

                                FIRST_SEEN: 2018-01-31 16:28:19

                                 LAST_SEEN: 2018-01-31 16:28:26

                          FIRST_ERROR_SEEN: 2018-01-31 16:28:19

                           LAST_ERROR_SEEN: 2018-01-31 16:28:26

1 row in set (0.00 sec)

 

ERROR: 

No query specified

 

 

 

 

 

威尼斯澳门在线 1

   1、 客户端程序在退出之前未调用mysql_close()正确关闭MySQL连接。

 

  

 

   2、 客户端休眠的时间超过了系统变量wait_timeout和interactive_timeout的值,导致连接被MySQL进程终止

 

 

官方资料介绍,host_cache的字段是统计被视为“阻塞”的连接错误的数量(根据max_connect_errors系统变量进行评估)。 只计算协议握手错误,并且仅用于通过验证的主机(HOST_VALIDATED = YES)。

   3、 客户端程序在数据传输过程中突然结束

 

 

SUM_CONNECT_ERRORS

 

The number of connection errors that are deemed “blocking” (assessed against the max_connect_errors system variable). Only protocol handshake errors are counted, and only for hosts that passed validation (HOST_VALIDATED = YES).

官方文档B.5.2.10 Communication Errors and Aborted Connections的介绍如下:

 

 

MySQL客户端与数据库建立连接需要发起三次握手协议,正常情况下,这个时间非常短,但是一旦网络异常,网络超时等因素出现,就会导致这个握手协议无法完成,MySQL有个参数connect_timeout,它是MySQL服务端进程mysqld等待连接建立完成的时间,单位为秒。如果超过connect_timeout时间范围内,仍然无法完成协议握手话,MySQL客户端会收到异常,异常消息类似于: Lost connection to MySQL server at 'XXX', system error: errno,该变量默认是10秒: 

 

 

 

 

If a client successfully connects but later disconnects improperly or is terminated, the server increments the Aborted_clients status variable, and logs an Aborted connection message to the error log. The cause can be any of the following:

 

 

mysql> show variables like 'connect_timeout';

+-----------------+-------+

| Variable_name   | Value |

+-----------------+-------+

| connect_timeout | 10    |

+-----------------+-------+

1 row in set (0.00 sec)

 

mysql> 

 

 

·         The client program did not call mysql_close() before exiting.

 

 

 

·         The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server. See Section 5.1.7, “Server System Variables”.

那么我们就构造一个网络超时引起的数据库连接被中断案例吧,我们用Linux下的netem与tc命令模拟构造出复杂环境下的网络传输延时案例,如下设置后,此时从测试服务器去访问MySQL服务器,都会出现延时11秒:

 

 

·         The client program ended abruptly in the middle of a data transfer.

 

 

 

 

 

 

[root@gettestlnx02 ~]# ping 10.20.57.24

 

PING 10.20.57.24 (10.20.57.24) 56(84) bytes of data.

 

64 bytes from 10.20.57.24: icmp_seq=1 ttl=62 time=0.251 ms

Other reasons for problems with aborted connections or aborted clients:

64 bytes from 10.20.57.24: icmp_seq=2 ttl=62 time=0.330 ms

 

64 bytes from 10.20.57.24: icmp_seq=3 ttl=62 time=0.362 ms

·         The max_allowed_packet variable value is too small or queries require more memory than you have allocated for mysqld. See Section B.5.2.9, “Packet Too Large”.

64 bytes from 10.20.57.24: icmp_seq=4 ttl=62 time=0.316 ms

 

64 bytes from 10.20.57.24: icmp_seq=5 ttl=62 time=0.281 ms

·         Use of Ethernet protocol with Linux, both half and full duplex. Some Linux Ethernet drivers have this bug. You should test for this bug by transferring a huge file using FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. Switch the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and test the results to determine the best setting.

64 bytes from 10.20.57.24: icmp_seq=6 ttl=62 time=0.377 ms

 

^C

·         A problem with the thread library that causes interrupts on reads.


 

10.20.57.24 ping statistics ---

·         Badly configured TCP/IP.

6 packets transmitted, 6 received, 0% packet loss, time 5716ms

 

rtt min/avg/max/mdev = 0.251/0.319/0.377/0.047 ms

·         Faulty Ethernets, hubs, switches, cables, and so forth. This can be diagnosed properly only by replacing hardware.

[root@gettestlnx02 ~]# tc qdisc add dev eth0 root netem delay 11000ms

 

[root@gettestlnx02 ~]# ping 10.20.57.24

 

PING 10.20.57.24 (10.20.57.24) 56(84) bytes of data.

 

64 bytes from 10.20.57.24: icmp_seq=1 ttl=62 time=11000 ms

如上介绍所示,有很多因素引起这些状态变量的值变化,那么我们来一个个分析、演示一下吧。首先,我们来测试一下导致Aborted Connect状态变量增加的可能因素

64 bytes from 10.20.57.24: icmp_seq=2 ttl=62 time=11000 ms

 

64 bytes from 10.20.57.24: icmp_seq=3 ttl=62 time=11000 ms

 

64 bytes from 10.20.57.24: icmp_seq=4 ttl=62 time=11000 ms

1、 客户端没有权限但是尝试访问MySQL数据库。

64 bytes from 10.20.57.24: icmp_seq=5 ttl=62 time=11000 ms

 

64 bytes from 10.20.57.24: icmp_seq=6 ttl=62 time=11000 ms

 

64 bytes from 10.20.57.24: icmp_seq=7 ttl=62 time=11000 ms

其实这里所说的没有权限,个人理解是:客户端使用没有授权的账号访问数据库 。打个比方,你尝试用账号kkk访问MySQL数据库,其实你也不知道数据库是否存在这个用户,实际上不存在这个用户。

 

 

 

实验对比测试前,先将状态变量清零。

威尼斯澳门在线 2

 

 

mysql> flush status;

Query OK, 0 rows affected (0.01 sec)

mysql> show status like 'Abort%';

+------------------+-------+

| Variable_name    | Value |

+------------------+-------+

| Aborted_clients  | 0     |

| Aborted_connects | 0     |

+------------------+-------+

2 rows in set (0.01 sec)

 

mysql> 

mysql> select host,user from mysql.user;

+-------------------------------+-----------+

| host                          | user      |

+-------------------------------+-----------+

| %                             | mydba     |

| %                             | root      |

| %                             | test      |

| 127.0.0.1                     | root      |

| 192.168.%                     | mydbadmin |

| 192.168.103.18,192.168.103,22 | LimitIP   |

| ::1                           | root      |

| db-server.localdomain         | root      |

| localhost                     | backuser  |

| localhost                     | root      |

+-------------------------------+-----------+

 

 

 

 

我们在测试服务器gettestlnx02连接MySQL数据库,如下所示(注意,如果你是在通过ssh连接这台服务器的话,此时在gettestlnx02上操作会相当慢。当然你也可以在MySQL服务器模拟网络延时,或者你将connect_timeout和网络延时都设小一点)

在本机的SecureCRT的另外一个窗口,使用不存在的账号kkk访问MySQL后,你会发现状态变量Aborted_connects变为1了。

 

 

 

 

 

[root@DB-Server ~]# mysql -u kkk -p

[root@gettestlnx02 ~]# mysql -h10.20.57.24 -utest -p

Enter password:

Enter password:

ERROR 1045 (28000): Access denied for user 'kkk'@'localhost' (using password: YES)

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0

 

[root@gettestlnx02 ~]#

 

 

威尼斯澳门在线 3

 

 

 

 

如上所示,由于网络延时超过10秒,导致连接MySQL失败,此时,你在MySQL服务器上查询host_cache表时,那么你就会看到SUM_CONNECT_ERRORS变成1了,COUNT_HANDSHAKE_ERRORS也变成了1.

也有可能,这个账号本身存在,但是只允许特定IP地址才能访问,实际环境中,可能是有人在进行尝试暴力破解。可能性非常多。我们来测试一下限制IP访问的情况

 

 

 

mysql> grant all on MyDB.* to mydbadmin@'10.20.%' identified by '123456';

Query OK, 0 rows affected (0.01 sec)

 

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

 

mysql>  show status like 'Abort%';

+------------------+-------+

| Variable_name    | Value |

+------------------+-------+

| Aborted_clients  | 0     |

| Aborted_connects | 0     |

+------------------+-------+

2 rows in set (0.00 sec)

 

 

 

 

威尼斯澳门在线 4

如上所示,创建一个mydbadmin的行号,只允许10.20段的IP访问,然后我们从192.168段的IP访问MySQL数据库

 

 

 

 

那么我们反复这样折腾三次,那么你会看到SUM_CONNECT_ERRORS变成3了,COUNT_HANDSHAKE_ERRORS也变成了3了.

 

 

# mysql -h 10.20.57.24 -u mydbadmin -p

 

Enter password:

 

ERROR 1045 (28000): Access denied for user 'mydbadmin'@'192.168.7.208' (using password: YES)

 

 

mysql> select * from host_cacheG;

*************************** 1. row ***************************

                                        IP: 192.168.27.180

                                      HOST: gettestlnx02

                            HOST_VALIDATED: YES

                        SUM_CONNECT_ERRORS: 3

                 COUNT_HOST_BLOCKED_ERRORS: 1

           COUNT_NAMEINFO_TRANSIENT_ERRORS: 0

           COUNT_NAMEINFO_PERMANENT_ERRORS: 0

                       COUNT_FORMAT_ERRORS: 0

           COUNT_ADDRINFO_TRANSIENT_ERRORS: 0

           COUNT_ADDRINFO_PERMANENT_ERRORS: 0

                       COUNT_FCRDNS_ERRORS: 0

                     COUNT_HOST_ACL_ERRORS: 0

               COUNT_NO_AUTH_PLUGIN_ERRORS: 0

                  COUNT_AUTH_PLUGIN_ERRORS: 0

                    COUNT_HANDSHAKE_ERRORS: 3

                   COUNT_PROXY_USER_ERRORS: 0

               COUNT_PROXY_USER_ACL_ERRORS: 0

               COUNT_AUTHENTICATION_ERRORS: 4

                          COUNT_SSL_ERRORS: 0

         COUNT_MAX_USER_CONNECTIONS_ERRORS: 0

COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS: 0

             COUNT_DEFAULT_DATABASE_ERRORS: 0

                 COUNT_INIT_CONNECT_ERRORS: 0

                        COUNT_LOCAL_ERRORS: 0

                      COUNT_UNKNOWN_ERRORS: 0

                                FIRST_SEEN: 2018-01-31 16:28:19

                                 LAST_SEEN: 2018-01-31 17:02:10

                          FIRST_ERROR_SEEN: 2018-01-31 16:28:19

                           LAST_ERROR_SEEN: 2018-01-31 17:02:10

1 row in set (0.00 sec)

 

ERROR: 

No query specified

此时,状态变量Aborted_connects就变为1了。

 

 

 

威尼斯澳门在线 5

 

 

 

 

然后我们用netem与tc 命令在测试服务器上取消网络延迟模拟,然后去测试连接MySQL数据库,如下测试所示:

 

 

2、 客户端输入的密码有误或者根本就是尝试各个密码。(A client uses an incorrect password)

 

 

[root@gettestlnx02 ~]# tc qdisc del dev eth0 root netem delay 11000ms

如下所示,使用test账号访问MySQL数据,但是输入了一个错误密码

[root@gettestlnx02 ~]# mysql -h10.20.57.24 -utest -p

 

Enter password:

[root@DB-Server ~]# mysql -u test -p

ERROR 1129 (HY000): Host '192.168.27.180' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

Enter password:

[root@gettestlnx02 ~]#

ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: YES)

 

[root@DB-Server ~]#

 

 

 

你检查状态变量Aborted_connects就会发现状态变量Aborted_connects变为2了。

威尼斯澳门在线 6

 

 

mysql>  show status like 'Abort%';

+------------------+-------+

| Variable_name    | Value |

+------------------+-------+

| Aborted_clients  | 0     |

| Aborted_connects | 2     |

+------------------+-------+

2 rows in set (0.00 sec)

 

 

 

 

 

3: A connection packet does not contain the right information.

此时就能构造出“ERROR 1129 (HY000): Host '192.168.27.180' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'”错误了。

 

 

 

 

这个比较容易构造,可以对MySQL的端口进行端口测试(ping 端口),因为psping的包不包含正确的信息(right information),测试之前,先将状态变量清空。

 

 

 

 

 

mysql> flush status;

 Query OK, 0 rows affected (0.00 sec)

mysql> show status like 'abort%';

+------------------+-------+

| Variable_name    | Value |

+------------------+-------+

| Aborted_clients  | 0     |

| Aborted_connects | 0     |

+------------------+-------+

2 rows in set (0.00 sec)

解决方案

 

 

 

 

在客户端对MySQL服务所在的主机进行端口连通性验证(psping)

 

 

 解决ERROR 1129 (00000): Host 'xxx' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'这个错误的方法比较多,不过有些方案都是临时方案。临时方案是指标不治本。关键还是需要解决网络错误(这个往往需要求助网络管理人员或系统管理员)

 

 

 

解决方法:

 

 

威尼斯澳门在线 7

 

 

1、将变量max_connection_errors的值设置为一个更大的值

 

 

 

 

如上所示,psping测试后,Aborted_connects变成了5,如果继续进行psping测试,那么这个状态变量就会继续增长。

mysql> show variables like 'max_connect_errors';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 3     |

+--------------------+-------+

1 row in set (0.01 sec)

 

mysql> set global max_connect_errors=150;

Query OK, 0 rows affected (0.00 sec)

 

mysql> 

 

 

 

 

威尼斯澳门在线 8

这个临时方案只是延迟触发IP被禁止访问的条件而已,而且在复杂情况或高并发的情况下,需要设置一个很大的值,否则很容易就会再次被触发。另外,变量只对当前环境生效,如果重启就会失效,如果需要永久有效,可以在my.cnf配置文件里面配置。

 

 

 

 

 

2:使用flush hosts

 

 

另外,如果超过max_connect_error的限制后,某一个客户端持续访问MySQL,这个是否会引起状态变量Aborted_connects变化呢,实验测试的答案是不会。有兴趣的可以验证一下,很奇怪,网上有不少文章都说如果连接数满了,也会导致Aborted_connects状态变量增加,实际上这个是不会引起状态变量Aborted_connects变化的。

mysql> flush hosts;

 

Query OK, 0 rows affected (0.00 sec)

 

 

 

mysql> select * from performance_schema.host_cache;

  4、 超过连接时间限制,主要是这个参数connect_timeout控制(mysql默认是10s,基本上,除非网络环境极端不好,一般不会超时。)

Empty set (0.00 sec)

 

 

 

mysql>

 

 

首先在一台MySQL数据库服务器上执行下面命令,我们用Linux下的netem与tc命令模拟构造出复杂环境下的网络传输延时案例,延时11秒。

当然你也可以mysqladmin flush-hosts 命令清理一下hosts cache信息

 

 

 

[root@DB-Server ~]# mysqladmin  --port=3306 -uroot -p flush-host

# tc qdisc add dev eth0 root netem delay 11000ms

Enter password:

 

 

 

那么host cache是什么呢? 官方介绍如下:

在另外一台MySQL服务器ping这台MySLQ服务器,如下所示,你会看到网络时延为11秒

 

 

The MySQL server maintains a host cache in memory that contains information about clients: IP address, host name, and error information. The server uses this cache for nonlocal TCP connections. It does not use the cache for TCP connections established using a loopback interface address (127.0.0.1 or ::1), or for connections established using a Unix socket file, named pipe, or shared memory.

 

 

# ping 10.20.57.24

 

PING 10.20.57.24 (10.20.57.24) 56(84) bytes of data.

简单来说,就是MySQL服务器在内存中维护一个包含客户端信息的缓存:IP地址,主机名和错误信息等。 服务器会将非本地TCP连接信息缓存起来。它不会缓存使用环回接口地址(127.0.0.1或者:: 1)建立的TCP连接,或者使用Unix套接字文件,命名管道或共享内存建立的连接。host cache信息可以通过performance_schema数据库下的host_cache表查询。

64 bytes from 10.20.57.24: icmp_seq=1 ttl=61 time=11001 ms

 

64 bytes from 10.20.57.24: icmp_seq=2 ttl=61 time=11001 ms

3:将变量host_cache_size设置为0

64 bytes from 10.20.57.24: icmp_seq=3 ttl=61 time=11001 ms

 

64 bytes from 10.20.57.24: icmp_seq=4 ttl=61 time=11001 ms

 

64 bytes from 10.20.57.24: icmp_seq=5 ttl=61 time=11001 ms

其实我想说这是一个最不靠谱的解决方法,只是让MySQL服务器不记录host cache信息而已。完全可以忽略这个方法。 

 

 

 

mysql> show variables like '%host_cache_size%';

+-----------------+-------+

| Variable_name   | Value |

+-----------------+-------+

| host_cache_size | 279   |

+-----------------+-------+

1 row in set (0.00 sec)

 

mysql> set global host_cache_size=0;

Query OK, 0 rows affected (0.00 sec)

 

mysql> select * from performance_schema.host_cache;

Empty set (0.00 sec)

 

mysql> 

本文由澳门在线威尼斯官方发布于电脑数据库,转载请注明出处:威尼斯澳门在线:MySQL参数max_connect_errors剖判解释

关键词:

上一篇:一款实时性能监测工具

下一篇:免安装版,的MySQL数据库下载安装