AutoCreate

mysql 5.7报1055错误的解决方法

别等时光非礼了梦想. 提交于 2019-11-27 13:30:21
今天由mysql 5.6升级到5.7的时候,遇到一个group by的错误: Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘trade.create_time’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 原来,执行下面语句发现,默认的sql_mode修改了,变成: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,而5.6版默认是:NO_ENGINE_SUBSTITUTION 1 show VARIABLES like 'sql_mode' ; 没办法,需要去掉ONLY_FULL_GROUP_BY,则执行 set global sql_mode= 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO