错误信息
Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'erp_hl.item.traceability_item_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决方法
在 mysql 的 my.cnf 配置文件中加入
[mysqld]
# 关闭ONLY_FULL_GROUP_BY特性sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
去除 only_full_group_by 特性,修改后重启mysql服务
启动mysql服务
service mysqld start停止mysql服务
service mysqld stop重启mysql服务
service mysqld restart
根据实际情况使用
最后查看
可以在任何能够连接和执行sql语句的地方用
select @@sql_mode
查看only_full_group_by是否还在 sql_mode 中