当前位置:网站首页>MySQL error: expression 1 of order by claim is not in group by claim and contains nonaggregated column
MySQL error: expression 1 of order by claim is not in group by claim and contains nonaggregated column
2022-06-29 16:04:00 【Long lasting bangbangjun】
Problem description
Wrong presentation
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
Error reporting analysis
This is the database sql_mode There's something wrong with the settings .Mysql Can support different SQL Pattern , Different SQL Patterns have different syntax , Perform different data verification profiles .
MySQL5.7 The default setting for the above version is mysql sql_mode = only_full_group_by attribute , Result in an error .
solve
Mode one : To settle temporarily ( restart mysql Error will still be reported later )
First step SELECT @@sql_mode;
The query result is :
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
The second step
Get rid of ONLY_FULL_GROUP_BY Reset value
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';
The third step
Above is the change of the overall situation sql_mode Valid for new database , For existing databases , It needs to be executed under the corresponding data :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';
Mode two : Permanent solution - Modify the configuration file
window Computer modification mysql Medium my.ini The configuration file ,linux and max modify myslq Medium my.ref file
Specific operation :
stay [mysqld] Below segment , Add the following
about mysql5.7 edition :sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
about 8 Above version : Get rid of NO_AUTO_CREATE_USER, as follows sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
边栏推荐
猜你喜欢

To prevent enterprise data leakage, use the fortress machine of network security products!

It is expected to significantly improve the computational performance of integrated photonic circuits. The Tsinghua team proposed a diffraction pattern neural network framework

时间格式化 GTM转北京时间

MySQL XA distributed transaction

发明了杀毒软件之后,他选择做一个极品混混

LeetCode-470-用Rand7()实现Rand10()

攻防演练之战前扫雷:漏洞管理的5大措施

Leetcode-234-palindrome linked list

Business Intelligence BI and business management decision-making thinking No. 3: business quality analysis

Volcano engine was selected into the first "panorama of edge computing industry" in China
随机推荐
《网络是怎么样连接的》读书笔记 - WEB服务端请求和响应(五)
【大家的项目】 Rbatis ORM官网上线
发明了杀毒软件之后,他选择做一个极品混混
C. Most Similar Words
C # learning 1: value type and reference type
2022年第一季度保险服务数字化跟踪分析
#夏日挑战赛# HarmonyOS - 方舟开发框架ArkUI 流光按钮效果
C. Where‘s the Bishop?
京东联盟API - 万能转链接口 - 京品库接口 - 接口定制
关于开展2022年江苏省重点领域 首版次软件产品征集工作的通知
天谋科技 Timecho 完成近亿元人民币天使轮融资,围绕 Apache IoTDB 打造工业物联网原生时序数据库
墨天轮“高可用架构”干货文档分享(含Oracle、MySQL、PG资料124篇)
Pre war minesweeping: five measures for vulnerability management
面试官:说一下MySQL事务隔离级别?
C語言大作業——匹配系統
R语言DALEX包的explain函数生成指定分类预测机器学习模型解释器、predict_parts函数基于oscillations方法分析对于指定的某一条样本、每个变量对于预测结国的贡献程度
EasyGBS调用获取实时快照接口时,出现白色方块该如何解决?
Kotlin annotation Statement and use
华为云AOM 2.0版本发布
How to create a login page in WordPress