报错信息
ERROR 1055 (42000): Expression #7 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘d1.label’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible withsql_mode=only_full_group_by
原因
在mysql8.0及以上的版本中,数据库sql_mode默认设置了only_full_group_by
win10解决方法
- 打开mysql安装目录下的my.ini
- 在[mysqld]下添加
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
- 重启mysql服务