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的更多相关文章

  1. 解决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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. [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 ...

随机推荐

  1. Mybatis源码解析2—— 实例搭建

    大家好,我是可乐. 上篇文章给大家撸了一遍用 JDBC 直接操作数据库的实例,还只是简单写了一个查询的接口,其代码量就已经很大了,并且可乐还给大家分析了直接使用 JDBC 带来的一些问题,总之是一种反 ...

  2. Linux之cat tail less常见用法

    1.cat 通常查找出错误日志 cat error.log | grep 'foo' , 这时候我们还有个需求就是输出当前这个日志的前后几行: cat error.log | grep -C 10 ' ...

  3. SpringBoot枚举传参

    创建一个接口所有枚举继承 package com.gecko.charging.common; public interface BaseEnum { Integer getCode(); } 具体的 ...

  4. WPF---数据绑定之ValidationRule数据校验(六)

    一.概述 我们知道,Binding好比架设在Source和Target之间的桥梁,数据可以借助这个桥梁进行流通.在数据流通的过程中,我们可以在Binding这座桥梁上设置关卡,对数据的有效性进行验证. ...

  5. C#设计模式---观察者模式(Observer Pattern)

    一.目的 提供一种一对多的关系,当主题发生变化时候,可以通知所有关联的对象. 二.定义 观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象,这个主题对象在状态发生变化时,会通 ...

  6. uwp 的锁屏功能

    [UWP开发]自定义锁屏&桌面壁纸 mtobeiyf关注 2015.11.01 00:16:55字数 394阅读 1,249 调用通用的API来设置桌面壁纸,可以实现很多有趣的功能.在Wind ...

  7. OJ 注意事项

    1,检查指针是否有效,即是否为NULL 1 void OutputMaxAndMin(int * pInputInteger, int InputNum, int * pMaxValue, int * ...

  8. io中的特殊流Properties

    对于去年学习IO的时候一些代码贴上来: 初识properties,因为继承自hashtable,其中可以使用put操作: package special; import java.util.Prope ...

  9. mybatis gengeator一键生成

  10. os.read

    #-*-coding:utf-8-*-__author__ = "logan.xu"import oscmd_res=os.popen("ls").read() ...