执行SQL时出现: ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

注意:

采用navicat新建数据库时,需要将编码方式设置为,字符集:utf8 -- UTF-8 Unicode ,排序规则:utf8_general_ci

在运行sql语句时,出现以下问题:

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c

原因:

MySQL 5.7.5及以上功能依赖检测功能。如果启用了ONLY_FULL_GROUP_BY SQL模式(默认情况下),MySQL将拒绝选择列表,HAVING条件或ORDER BY列表的查询引用在GROUP BY子句中既未命名的非集合列,也不在功能上依赖于它们。(5.7.5之前,MySQL没有检测到功能依赖关系,默认情况下不启用ONLY_FULL_GROUP_BY。有关5.7.5之前的行为的说明,请参见“MySQL 5.6参考手册”)。

解决办法:

打开: /etc/my.cnf

滚动到文件底部复制并粘贴

[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

到文件的底部

保存并退出输入模式

systemctl  restart mysqld.service

重启MySQL。

原文地址:https://www.cnblogs.com/zeenzhou/p/10898876.html

时间: 2024-10-07 12:15:44

执行SQL时出现: ORDER BY clause is not in GROUP BY clause and contains nonaggregated c的相关文章

解决mysql报错:- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'

mysql执行报错: - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_fu

解决[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

错误: Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only

mysql Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona

1. 操作mysql的时候提示如下错误 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema. PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

问题:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only

MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

方案1: 修改sql_mode的值 set sql_mode = '';set sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'; 再次执行刚才的语句,就不会报错了. 方案2: 在my.cnf添加如下: [mysqld] sql_mode='NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO

windows server 2008 安装MySQL 8.0 遇到报错 1055 - Expression #1 of ORDER BY clause is not in GROUP BY

mysql安装参考教程:https://blog.csdn.net/qq_37350706/article/details/81707862 安装完毕后 执行sql语句 SELECT * FROM court_info GROUP BY second_court_name HAVING COUNT(second_court_name) > 1 报错 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause an

Yii2中多表关联查询(join、joinwith) with是不执行sql的

Yii2中多表关联查询(join.joinwith) 我们用实例来说明这一部分 表结构 现在有客户表.订单表.图书表.作者表, 客户表Customer (id customer_name) 订单表Order (id order_name customer_id book_id) 图书表 (id book_name author_id) 作者表 (id author_name) 模型定义 下面是这4个个模型的定义,只写出其中的关联 Customer class Customer extends \

oracle执行update时卡死问题的解决办法

今天进行项目开发时,为了测试项目中SQL执行效果,就用PLSQL Developer执行了一下,没有commit就继续敲代码了,之后重新使用PLSQL Developer时,可能是网络原因,PLSQL Developer断开了与数据库连接并且卡死,便强制结束了.代码敲完后进行测试,项目执行后没效果,并且无响应,debug后发现jdbc执行SQL时没反应了,问了一下谷老师才找到原因. 由于在PLSQL Developer执行update时没有commit,oracle将该条记录锁住了. 可以通过以

查询oracle sql的执行计划时,一个很重要的视图--dba_hist_sql_plan

本文的编写得到枯荣长老的大力帮助,在此表示感谢. 本文适用的oracle db版本为oracle 10g或者更高版本. 之所以说这个视图很重要,是因为该视图中有一列是在awrsqrpt报告中没有的.这一列就是 filter_predicates列. SELECT plan_hash_value, TO_CHAR(RAWTOHEX(child_address)), TO_NUMBER(child_number), id, LPAD(' ', DEPTH) || operation operatio