[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause...

问题描述:

在mysql客户端执行delete删除语句时,报出了以下错误:

[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版本为: 5.7.18

select version() from dual;
经过搜索后,得到以下解决方案:

1. 使用find命令查找名为my.cnf的文件

# find / -name my.cnf
2. 使用vi命令编辑该文件,增加以下语句:

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
最终部分代码如下所示:

character-set-server=utf8mb4
lower_case_table_names=1

skip-host-cache
skip-name-resolve

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

[client]
default-character-set=utf8mb4
3. 保存后, 重启mysql服务

# service mysqld restart


解决收工.

你可能感兴趣的:(MySQL)