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. ubuntu18.4 与pc notepad++ 使用nppftp

    首先在linux上部署 vsftpd 安装过程可能有一些问题.我之前的一个文章有所说明. 然后更改配置文件 vsftpd.conf 最简单是开启匿名登录,有时候还要开启root登录,在user文件里面 ...

  2. Ladp存储规则

    Ladp存储规则 区分名(DN,Distinguished Name) 和自然界中的树不同,文件系统/LDAP/电话号码簿目录的每一片枝叶都至少有一个独一无二的属性,这一属性可以帮助我们来区别这些枝叶 ...

  3. msp432搭建平衡小车(二)

    前言 上一节掌握了使用pwm驱动电机,接下来介绍如何使用msp432读取mpu6050数据 正文 首先我们得知道mpu6050通信方式,由于mpu6050只能用i2c通信,所以学会使用msp432的i ...

  4. @CreatedDate@CreatedBy@LastModifiedBy@LastModifiedDate

    启动类上加上@EnableJpaAuditing 实体类,注意需要加上@EntityListeners(AuditingEntityListener.class)这个注解才能使@CreatedDate ...

  5. uwp Button的动态效果

    你应该覆盖Button样式 <Page.Resources> <Style TargetType="Button" x:Key="CustomButto ...

  6. snoop的基本用法

    关于Snoop的用法   snoop是开发wpf应用程序的利器.用它可以观察WPF的可视树,监听事件,更改元素属性等.   下面我介绍下snoop一些用法.   1.获取指定应用程序的UI     打 ...

  7. node上传包到npm公共库

    自己想做些插件分享出去,npm上传你的插件包是最好的选择,废话不多说,直接开干: 1.我们先建一个文件夹,随便先写个js文件,名字随便写,命名hello.js: 2.再用npm init命令生成pac ...

  8. Linux从头学09:x86 处理器如何进行-层层的内存保护?

    作 者:道哥,10+年的嵌入式开发老兵. 公众号:[IOT物联网小镇],专注于:C/C++.Linux操作系统.应用程序设计.物联网.单片机和嵌入式开发等领域. 公众号回复[书籍],获取 Linux. ...

  9. Promise.resolve( data)与Promise.reject( data )

    Promise.resolve( data)与Promise.reject( data ) 常用来生成已经决议失败或成功的promise实例: 1.Promise.reject(data)不管传递的是 ...

  10. 100个裁判对n个选手做无并列排名问题探析

    原题:n 个选手(n ≥ 3)参加花样自行车比赛,100 个裁判独立对各选手的表现给出无并列排名.已知对任意三个选手 A.B.C 和任意三个裁判 X.Y.Z 均不会出现如下的情形:X 给出 A > ...