sql_mode=ONLY_FULL_GROUP_BY 导致lepus监控mysql5.7报错

lepus监控mysql5.7出现的问题:

2017-09-12 12:18:53 [INFO] check mysql controller finished.

 [WARNING] check mysql 192.168.10.9:3306 failure: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'information_schema.processlist.USER' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

2017-09-12 12:18:48 [WARNING] check mysql  192.168.10.9:3306 failure: sleep 3 seconds and check again.

2017-09-12 12:18:49 [WARNING] check mysql  192.168.10.8:3306 failure: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'information_schema.processlist.USER' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

2017-09-12 12:18:49 [WARNING] check mysql 192.168.10.8:3306 failure: sleep 3 seconds and check again.

2017-09-12 12:18:53 [INFO] check mysql controller finished.


登陆192.168.10.9机器和192.168.10.8机器查看mysql5.7的sql_mode默认的模式为:

mysql> SELECT @@GLOBAL.sql_mode;

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

| @@GLOBAL.sql_mode                                                                                                                         |

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

| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |

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

SET global sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'


这样mysql不需要重启


或者是写入my.cnf

[mysqld]

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION


重启mysql5.7解决



 本文转自 wjw555 51CTO博客,原文链接:http://blog.51cto.com/wujianwei/1964613

上一篇:微博拟2月28日正式开放140字发布限制


下一篇:微软今天发布Windows 7/Server 2008 R2 SP1 RC候选版