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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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解决

本文出自 “10931853” 博客,请务必保留此出处http://wujianwei.blog.51cto.com/10931853/1964613

以上是关于sql_mode=ONLY_FULL_GROUP_BY 导致lepus监控mysql5.7报错的主要内容,如果未能解决你的问题,请参考以下文章

mysql 5.7 或以上版本 group by 问题记录

mysql 使用 GROUP BY 时报错 ERROR 1055 (42000)

在 Sequel Pro 中禁用严格模式

MySQL数据库_MySQL数据库表记录操作语句

mysql5.6 sql_mode设置为宽松模式

[SUCTF 2019]EasySQL1 及sql_mode