在安装mysql5.7.13后,执行SQL语句出现如下情况:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
[SQL]select * from t_area
受影响的行: 0
时间: 0.600s
[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
受影响的行: 0
时间: 0.600s
[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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
初步定为sql_mode配置不正确导致的,修改/etc/my.cnf 文件相应参数。根据官网信息应该在sql_mode参数中去除ONLY_FULL_GROUP_BY值即可,由于这个参数在命令模式下和配置文件的写法不同(命令模式为:sql_mode,配置文件中位:sql-mode,差异在于中间的短横线)。本人在配置的时候直接copy的是默认配置文件/usr/local/mysql/support-files/my-default.cnf,在此基础上进行修改,在该配置文件中,sql_mode采用的写法即为下划线,如下图所示:
从而导致该错误检查好几遍都没有发现问题所在,一直报1055错误,通过仔细研读官网资料,比较配置文件发现此问题。记录下来警示自己下次不犯类似错误。