当前位置:Gxlcms > 数据库问题 > Mysql only_full_group_by 引起的错误

Mysql only_full_group_by 引起的错误

时间:2021-07-01 10:21:17 帮助过:6人阅读

]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column -._task.id which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

#查询当前的模式设置

SELECT @@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

#设置mode[需要root有权限]

set GLOBAL sql_mode =‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ‘;

#直接修改配置文件,然后重启

在my.cnf 里面设置
sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION‘
在sql_mode 中去掉only_full_group_by 

Mysql only_full_group_by 引起的错误

标签:group   配置   _for   sub   string   mysq   erro   stat   err   

人气教程排行