SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP

错误重现
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘siku_carpooling.sc_template.id’ which is not functionally dependent on columns in GROUP BY clause; this is in

错误解决

  1. 运行命令SET GLOBAL sql_mode=’’; 但是这样重启后就失效了,因为set global的配置是放在内存中的。

  2. 设置mysql的配置文件,在/etc/my.cnf

ps:这个设置是mysql5.7.5版本之后默认加入的,在mysql5.7.11里show global variables like “sql_mode”,得到如下的结果:

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP_第1张图片

  1. 修改/etc/my.cnf在[mysqld]下面添加如下列:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

你可能感兴趣的:(数据库,mysql集群)