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. cas5.3.1 从搭建到连接mysql(简而优美)

    前言: cas是单点登录服务框架,为单点登录业务提供了便捷服务,它分为client,server端,client端要聚合到我们自己的项目. server端要单独构建运行,本篇文章主要讲解一下cas5. ...

  2. 从零开始实现简单 RPC 框架 3:配置总线 URL

    URL 的定义 URL 对于大部分程序猿来说都是很熟悉的,其全称是 Uniform Resource Locator (统一资源定位器).它是互联网的统一资源定位标志,也就是指网络地址. 一个标准的 ...

  3. E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)E: Unable to l ...

  4. mongodb(docker-compose)

    version: '3.1' services: mongo: image: mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME ...

  5. python的GUI框架tkinter,实现程序员的流氓式表白逻辑

    导入依赖 '''导入依赖''' import tkinter as tk import tkinter.messagebox as msg 创建并隐藏根窗口 '''创建并隐藏根窗口''' root_w ...

  6. QT 资源文件的添加

  7. SpringBoot中的thymeleaf引擎报错

    关于:thymeleaf报错: An error happened during template parsing (template: "class path resource [temp ...

  8. air530GPS数据通过air202上传阿里云

    写硬件博客真是太难了 GPS/北斗 导航模块 Air530开发板G1学习日记 上面这个博客详细介绍了如何测试使用Air530模块根据稳重[Air530 和Air 202 进行配合使用,实现2G GPR ...

  9. python画循环圆

    import turtle for i in range(100,0,-5): # 从100到0循环递减每次减5 turtle.circle(i,90) 不懂为啥第一次运行会出错,错了再运行一遍for ...

  10. PipedInputStream and PipedOutputStream example

    必须要有PipedInputStream ,PipedOutputStream 在不同线程,不然死锁 Java.io.PipedOutputStream and java.io.PipedInputS ...