MySQL5.7.14执行SQL时出现1055错误

错误:

[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

在Navicat中执行SQL语句时出现了如上所示的错误。
我本机安装的是wamp,在网上找了半天解决方法,说是要修改my-default.ini/my.cnf中sql-mode这个参数,由于对MySQL的配置不是很熟悉,不知道具体该怎么改,是新添加一行呢?还是覆盖旧的sql-mode配置?网上也没查清楚,不过我大概知道是在这个参数上做手脚。
于是就自己随便找,结果在my.ini中看到了如下一行,我觉得很可疑,于是我去掉了注释,然后重启MySQL,居然成功了。

; The default SQL mode in MySQL 5.7 includes these modes:
; ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
; no line sql-mode="" gives default SQL mode
; To clear the SQL mode explicitly, set it to an empty string using sql-mode=""
;sql-mode=""
sql-mode="STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE,NO_AUTO_CREATE_USER"

MySQL5.7.14执行SQL时出现1055错误_第1张图片
小小笔记,暂且记载一下下。

你可能感兴趣的:(MySQL)