1. 程式人生 > >sql_mode=ONLY_FULL_GROUP_BY 導致lepus監控mysql5.7報錯

sql_mode=ONLY_FULL_GROUP_BY 導致lepus監控mysql5.7報錯

sql mode only

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報錯