解决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. 饭后半小时养胃黄金期
  2. Android MVVM 架构应用实现
  3. 年月日_C++计算输入的年月日是这一年的第几天
  4. spark rest_Spark简介,您的下一个REST Java框架
  5. html响应式五栏布局,HTML – 响应式2列CSS布局,包括固定宽度的侧边栏?
  6. Symfony 4.2.4 和 3.4.23 发布,经典 PHP Web 开发框架
  7. c专家编程(C专家编程pdf)
  8. Premiere Pro 2022安装教程(附详细图文教程)
  9. LPC1788学习笔记(19-01-11)
  10. 公司合同管理软件有哪些?
  11. FDTD PDMS光学参数txt文档
  12. idea社区版激活_使用IntelliJ IDEA社区版代替付费版
  13. molar mass
  14. 清除电脑bios密码
  15. 【我的渲染技术进阶之旅】关于C++轻量级界面开发框架Dear ImGui介绍
  16. C语言克鲁斯卡尔算法的实现
  17. java基础之静态方法
  18. 从IE到Chromium Edge:微软浏览器的浮沉史
  19. 大数据说:原来“首堵”不是北京!
  20. DeviceIoControl接口

热门文章

  1. 微信小程序中获取用户微信公众号授权(openid)用来发送模板消息
  2. 我用 python 做了款可开淘宝店赚钱的工具!
  3. android-4集成高德地图的搜索和导航功能
  4. css3实现的僵尸走路动画
  5. U-Boot参数设置 .
  6. 19、弱电工程综合布线报价多少钱一个点位?弱电入门学习
  7. 2015年2月2日 奶农倒牛奶的背后
  8. 淘宝商家开通淘金币可以提高商品转化率吗?
  9. 淘淘商城第24讲——实现商品类目的选择
  10. 【报告分享】2021民宿行业数据报告-云掌柜(附下载)