Mysql8.0及以上 only_full_group_by报错解决方案

报错信息

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解决方法

  1. 打开mysql安装目录下的my.ini
  2. 在[mysqld]下添加
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
  1. 重启mysql服务

你可能感兴趣的:(数据库)