环境:CentOS release 6.5 (Final),MySQL:5.7.12
在error.log日志里有如下的提示,太多了,容易让人看不到重要的信息,所以打算屏蔽掉。
-
11-28T19:20:55.658970+08:00 878538 [Note] Aborted connection 878538 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
-
2017-11-28T19:21:31.417245+08:00 878728 [Note] Aborted connection 878728 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:21:31.728802+08:00 878635 [Note] Aborted connection 878635 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:21:42.780035+08:00 878504 [Note] Aborted connection 878504 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:21:52.114134+08:00 878279 [Note] Aborted connection 878279 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:22:12.843467+08:00 878736 [Note] Aborted connection 878736 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:22:42.750175+08:00 879051 [Note] Aborted connection 879051 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:22:42.887395+08:00 878825 [Note] Aborted connection 878825 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
-
2017-11-28T19:23:21.989617+08:00 879318 [Note] Aborted connection 879318 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:23:42.769896+08:00 879407 [Note] Aborted connection 879407 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:23:42.870136+08:00 879454 [Note] Aborted connection 879454 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
-
2017-11-28T19:23:52.125260+08:00 879071 [Note] Aborted connection 879071 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
-
2017-11-28T19:23:55.656959+08:00 879511 [Note] Aborted connection 879511 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.56.98' (Got timeout reading communication packets)
-
2017-11-28T19:24:12.842803+08:00 879537 [Note] Aborted connection 879537 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
从参数log_warnings入手
-
mysql> show global variables like '%log_warning%';
-
+---------------+-------+
-
| Variable_name | Value |
-
+---------------+-------+
-
| log_warnings | 2 |
-
+---------------+-------+
-
1 row in set (0.00 sec)
看下这个参数的官方解释:
log_warnings is enabled by default (the default is 1 before MySQL 5.7.2, 2 as of 5.7.2). To disable it, set it to 0. If the value is greater than 0, the server logs messages about statements that are unsafe for statement-based logging. If the value is greater than 1, the server logs aborted connections and access-denied errors for new connection attempts. See Section B.5.2.10, “Communication Errors and Aborted Connections”.
恰恰我这边设置的为2,把它修改为1:
-
set global log_warnings=1;
修改后在error.log里面这些提示消失了。
最后要注意的是log_warnings在未来的版本中会弃用,由另一个参数log_error_verbosity替代。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/20893244/viewspace-2147893/
,如需转载,请注明出处,否则将追究法律责任。