今天写了个非id 的group by,结果提示1055
sqlalchemy.exc.InternalError: (pymysql.err.InternalError) (1055, "Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'heanny.map_cameras.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by")然后发现是因为
在MySQL5.7之后,sql_mode中默认存在ONLY_FULL_GROUP_BY,SQL语句未通过ONLY_FULL_GROUP_BY语义检查所以报错。
关闭ONLY_FULL_GROUP_BY
查询全局sql_mode的值
select @@global.sql_mode;修改值
set @@global.sql_mode=(select replace(@@global.sql_mode,'ONLY_FULL_GROUP_BY'',''));windows 修改my.ini文件 在文件最后添加
linux 查询配置文件在哪