报错信息:

......not in GROUP BY clause and contains nonaggregated column ......  which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

查看sql_mode: select @@sql_mode

原因:一些MySQL的版本默认设置了:sql_mode=only_full_group_by

解决办法:

①到Linux中找到/ect/my.cnf (我的是CentOs7 )

②编辑文件:

mybatis中group by 语句中SQL报错,原因是MySQL版本的group规则默认是:only_full_group_by

③,先到执行命令:select @@sql_mode,

only_full_group_by去掉,在复制里面的内容,设置进配置文件中,如上图。

④重启mysql服务:service mysqld restart



相关文章:

  • 2021-11-21
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-23
  • 2021-09-03
  • 2021-04-30
  • 2021-06-22
相关资源
相似解决方案