mysql8.0 分组报错 this is incompatible with sql_mode=only_full_group_by 解决方案

371 阅读1分钟

本文已参与「新人创作礼」活动,一起开启掘金创作之路。

今天新装了个mysql8, 执行 sql 的 group by 操作的时候执行失败, 抛出了 this is incompatible with sql_mode=only_full_group_by 的错误信息

修改 /etc/my.cnf 设置sql_mode

[mysqld]
sql_mode ='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'

停止 systemctl stop mysqld.service

启动 systemctl start mysqld.service

完美解决