Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column xxxx

mysql-font报错
解决方法

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 配置中 sql_mode 配置了 only_full_group_by,需要 GROUP BY 中包含所有 在 SELECT 中出现的字段。

set sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

本质上事将配置写到my.ini最后
解决了

你可能感兴趣的:(Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column xxxx)