1. 程式人生 > >MySQL5.7.14執行SQL時出現1055錯誤

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"

這裡寫圖片描述
小小筆記,暫且記載一下下。