error:1055 ,sql_mode=only_full_group_by的处理方式

Mysql版本升级到5.7.20版本后,查询的时候出现如下报错:

1055, "Expression #2 of SELECT list is not in GROUP BY 
clause and contains nonaggregated column 'xx' which is not functionally dependent on columns in GROUP BY clause; 
this is incompatible with sql_mode=only_full_group_by"

解决方式:
用root账户登录:

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

你可能感兴趣的:(error:1055 ,sql_mode=only_full_group_by的处理方式)