mysql5.7执行sql语句提示Expression #1 of ORDER BY clause is not in GROUP BY
mysql 新版本出现group by 语句不兼容问题
[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_full_group_by
解决过程
1. 查看数据库设置的 sql_mode
# 进入mysql命令行 select @@global.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
我们只要去掉ONLY_FULL_GROUP_BY 这个设置就好。
2.去掉ONLY_FULL_GROUP_BY 临时
修改my.cnf 配置文件,删掉only_full_group_by这一项,如果没有设置,直接根据上面的查询结果去掉ONLY_FULL_GROUP_BY
增加到配置文件,重启mysql即可。
如果需要临时修改一个库的可以直接执行语句:(mysql命令行中)
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';
但以上方式只是临时的,重启mysql后会恢复原来的模式,产生错误
3.去掉ONLY_FULL_GROUP_BY 永久 在配置文件 /etc/my.cnf 或自己的mysql配置文件中
[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
重启mysql即可
mysql5.7执行sql语句提示Expression #1 of ORDER BY clause is not in GROUP BY的更多相关文章
- 解决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 c ...
- mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonagg
mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonagg ...
- MySQL5.7.27报错[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated
mysql5.7.27在运行更新语句时出现如下情况,mysql5.6之前没有这种情况出现. of ORDER BY clause is not in GROUP BY clause and conta ...
- 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contai
之前一直使用的mysql5,突然换成8之后,有许多地方不一样,今天就碰到一个. 在使用sql语句创建表时,报错: 1055 - Expression #1 of ORDER BY clause is ...
- 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 GRO
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated c ...
- mysql错误:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated
今天迁移django数据库的时候,跑程序的时候出现这样的错误: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY cla ...
- mysql 5.7 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ...报错
使用mysql在执行一条插入语句时 , ', "hhh"); 报错:Expression #1 of ORDER BY clause is not in GROUP BY clau ...
- Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'infor
今天在Navicat上执行SQL增删改查数据操作的时候出现了下面这个问题 Expression #1 of ORDER BY clause is not in GROUP BY clause and ...
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ'
在Navicat Premium中执行Mysql的一条删除语句,虽然执行成功了,却提示已下错误: 受影响的行: 时间: .005s of ORDER BY clause is not in GROUP ...
随机推荐
- 中文屋 Chinese room
中文屋 Chinese room 深夜了,假装有个bgm,虽然我真的有个bgm<中间人> 强烈安利,无敌好听,冰老师yyds 开始瞎侃 在经历了机器学习的洗礼以后,感觉人都升华了,本来对于 ...
- SpringBoot开发十九-添加评论
需求介绍 熟悉事务管理,并且应用到添加评论的功能. 数据层:增加评论数据,修改帖子的评论数量 业务层:处理添加评论的业务,先增加评论再更新帖子的评论数量(因为用到了两个DML操作所以要用到事务管理) ...
- JacksonUtils
package com.intfish.resourceserver.util; import com.fasterxml.jackson.annotation.JsonInclude; import ...
- 安全工具推荐之Goby篇
Goby(鰕虎鱼) 这个东西出来也很久了,有一年多了吧,个人感觉用起来还不错(当然见仁见智哈,别喷我),今天拿来水一篇 官网有很详细的使用说明,所以本文纯属发表一下感慨,非技术贴 官网在此:https ...
- Pikachu-URL重定向、目录遍历、敏感信息泄露模块
一.不安全的URL跳转 1.概述 不安全的url跳转问题可能发生在一切执行了url地址跳转的地方.如果后端采用了前端传进来的(可能是用户传参,或者之前预埋在前端页面的url地址)参数作为了跳转的目的地 ...
- efcore分表下"完美"实现
ShardingCore 如何呈现"完美"分表 这篇文章是我针对efcore的分表的简单介绍,如果您有以下需求那么可以自己选择是否使用本框架,本框架将一直持续更新下去,并且免费开源 ...
- NOIP 模拟 $17\; \rm 世界线$
题解 \(by\;zj\varphi\) 此题经简单观察可发现,一个点的贡献就是这个点所能到的点减去它的出度 那么我们就可以暴力搜索,但是显然会超时,所以我们可以使用一个黑科技 \(\rm bitse ...
- liunx上安装nacos
下载nacos wget https://github.com/alibaba/nacos/releases/download/1.4.1/nacos-server-1.4.1.tar.gz 启动服务 ...
- kubebuilder实战之四:operator需求说明和设计
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- Quartz任务调度(4)JobListener分版本超详细解析
JobListener 我们的jobListener实现类必须实现其以下方法: 方法 说明 getName() getName() 方法返回一个字符串用以说明 JobListener 的名称.对于注册 ...