解决SELECT list is not in GROUP BY clause and contains nonaggregated column ‘XXX’

我是在Linux上面新装了一个mysql5.7的数据库,然后上传项目,日志中出现了这个错误信息。

网上找了许久,终于解决了,将解决方法记录如下。
1、查询 sql_mode

select @@sql_mode;

1

查询出来是 ONLY_FULL_GROUP_BY

这个严格限制了分组的条件。 解释请看这篇文章
2、去掉ONLY_FULL_GROUP_BY,重新设置值。

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

1
    2

上面 改变了全局sql_mode,对于新的数据库有效。已存在的数据库,则无效。

3、最终解决办法

Linux上面是在my.cnf设置 一般是在 vi /etc/my.cnf 路径

Windows 上面是my.ini设置。

[mysqld]
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

解决SELECT list is not in GROUP BY clause and contains nonaggregated column ‘XXX’相关推荐

  1. 解决SELECT list is not in GROUP BY clause and contains nonaggregated column..

    问题描述 在一次zabbix的mysql库中写联合查询语句时报错 1055 - Expression #1 of SELECT list is not in GROUP BY clause and c ...

  2. mysql 报错解决思考Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    mysql报错: [Err] 1055 - Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggrega ...

  3. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    场景 安装了mysql5.7,用group by 查询时抛出如下异常: Expression #1 of SELECT list is not in GROUP BY clause and conta ...

  4. 报错,> 1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column

    错误: mysql: select * ,count(*)as count from app_cash_trans_log group by app_cash_trans_log.tran_code ...

  5. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'userinfo.

    安装了mysql5.7,用group by 查询时抛出如下异常: Expression #3 of SELECT list is not in GROUP BY clause and contains ...

  6. mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column.

    mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column. 出现原因 使用g ...

  7. SELECT list is not in GROUP BY clause and contains nonaggregated column

    问题: SELECT list is not in GROUP BY clause and contains nonaggregated column 原因: 举个例子,有这么一个查询语句: SELE ...

  8. 使用group by语句时,报错,获取不到数据,出现SELECT list is not in GROUP BY clause and contains nonaggregated column 问题

    SELECT list is not in GROUP BY clause and contains nonaggregated column 报错如下: Expression #2 of SELEC ...

  9. [MySQL]SELECT list is not in GROUP BY clause and contains nonaggregated column...

    项目在windows上运行正常,迁移到Linux系统上就出现了这个错,经查是由于本人sql不规范且恰好mysql的sql_mode启用了only_full_group_by,当sql语句中使用了分组查 ...

最新文章

  1. React Native 与 嵌入Android原生与Activity页面互相跳转
  2. python自学书籍顺序-2018最全各阶段Python学习书籍汇总!
  3. 软核、固核、硬核的区别【转】
  4. Android Resource介绍和使用
  5. 流浪宠物救助网站前端页面_全国爱心人士齐聚鞍山 救助流浪猫狗
  6. cesium坡度坡向分析_综合分析地理空间,科学规划乡村区域
  7. lamda获取参数集合去空_集合源码解析之LinkedList
  8. python简单超级马里奥游戏下载大全_Python实现超级玛丽游戏系列教程02玛丽走跑...
  9. dedesmc 手机端生成静态页
  10. 一文详解Python中的*可变参数与**关键字参数
  11. 不胜唏嘘!衰落的苹果与崛起的荣耀
  12. 利用React 和ant-design 搭建cnode项目的随笔
  13. 青梅酒太多不知该怎么选?记得你爱吃 的口味就可以
  14. mysql结算订单表到用户_Luffy之结算订单页面(订单模型表的创建,订单的生成,以及订单详情展示等)...
  15. 计算机专业课只考c语言的学校,【择校必看】十三所计算机专业课只考数据结构的985院校!...
  16. js购物车功能php,使用JS实现购物车功能步骤详解
  17. Windows程式开发设计指南(十七)文字和字体
  18. 深圳和广州的培训机构名单(不定期更新)
  19. 用MATLAB做周期三角波的傅里叶级数,Matlab 周期方波信号傅里叶级数展开
  20. 拓嘉辰丰电商:拼多多一件代发三大优势有哪些

热门文章

  1. 阿里云 ECS 服务器上如何搭建 Hadoop 集群详细步骤图解
  2. C语言的结构体前置声明,?C语言的不完整类型和前置声明
  3. 原生javascript的账号密码登录验证
  4. 怎么把人物模型走路、跑步动画拼接起来
  5. Idea使用系列之一:Idea设置类注释模板和方法注释模板
  6. html+css仿QQ邮箱静态界面
  7. 可视为线性回归的曲线回归(R语言)
  8. ue4 开发动作游戏_ue4游戏开发虚幻4学习教程资源素材合集
  9. 采用开盘价交易的方法
  10. 复习单片机:温度检测 DS18B20(内含:1 DS18B20 介绍+2 硬件设计+3 软件设计+4 实验现象)