kaisawind's blog
  • 关于
  • 所有帖子

Mysql group by this is incompatible with sql_mode=only_full_group_by - Wed, Jan 20, 2021

Mysql group by this is incompatible with sql_mode=only_full_group_by

mysql版本8.0.18,使用客户端查询数据时报错 Mysql group by this is incompatible with sql_mode=only_full_group_by.

原因: mysql 8.0.18默认SQL Mode是ONLY_FULL_GROUP_BY STRICT_TRANS_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE ERROR_FOR_DIVISION_BY_ZERO NO_ENGINE_SUBSTITUTION

需要将ONLY_FULL_GROUP_BY去掉

解决1: 重启失效

set sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

解决2: 配置mysql.cnf

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION


辽ICP备2021007608号 | © 2025 | kaisawind

Facebook Twitter GitHub