MYSQL5.7版本sql_mode=only_full_group_by问题

报错信息:

[Err] 1055 – Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

出现以上错误时进放MySQL命令行查看一下sql_mode值:

如结果如下:

则需要重新设置sql_mode, 在 MySQL命令行执行下面的命令:

出错原因:

mysql5.7.x版本,默认是开启了 only_full_group_by 模式的,但开启这个模式后,原先的 group by 语句就出现该错误。

“MYSQL5.7版本sql_mode=only_full_group_by问题”的2个回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.