--数据库中插入数据或执行sql语句时一直报下面这个错误:
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

原因:这是数据库的sql_mode设置的有问题。Mysql可以支持不同的SQL模式,不同的SQL模式会有不同的语法,执行不同的数据校验简查。

首先,可以先查看一下数据库现在的sql_mode的值,sql语句为:

select version(), @@sql_mode;

获取结果可能如下,不同的设置查询出来的有区别:

然后可以使用如下语句,去设置自己需要的sql_mode.

SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

二、尝试第二种方案

1、查看sql_mode

select @@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

2、去掉ONLY_FULL_GROUP_BY,重新设置值。

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‘;
3、上面是改变了全局sql_mode,对于新建的数据库有效。对于已存在的数据库,则需要在对应的数据下执行:

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‘;
或者:
在my.cnf 里面设置
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
在sql_mode 中去掉only_full_group_by

传送门:https://blog.csdn.net/u012259256/article/details/56482218

MYSQL---Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column '的更多相关文章

  1. MySQL [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause

    MySQL[Err]1055 上次MySQL5.7.19主从建立完成之后,所有的测试都是在MySQL命令行下进行的,最近用Navicat Premium进行MySQL的连接,然后在插入数据的时候MyS ...

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

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

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

  5. mysql Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona

    1. 操作mysql的时候提示如下错误 [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and cont ...

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

  7. [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

    问题:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregate ...

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

  9. 解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat

    解决MySQL报错:1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'informat ...

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

随机推荐

  1. [AMPPZ2014]Jaskinia

    [AMPPZ2014]Jaskinia 题目大意: 一个\(n(n\le3\times10^5)\)的树,\(m(m\le3\times10^5)\)个约束条件\((a_i,b_i,d_i)\).请你 ...

  2. [LOJ6356]四色灯

    [LOJ6356]四色灯 题目大意: 有\(n(n\le10^9)\)个编号\(1\sim n\)的格子和\(m(m\le20)\)个按钮.每个格子有一个初始为\(0\)的数,每个按钮有一个数字\(a ...

  3. 获取当前泛型类的传入,BaseDaoImpl<T> implements BaseDao<T>

    public abstract class BaseDaoImpl<T> implements BaseDao<T> { private Class<T> claz ...

  4. 修改mybatis plus Generator模板生成字段注释枚举常量

    修改mybatis plus Generator模板生成字段注释枚举常量 本文基于最新的mybatis-plus 3.0.1版本源码修改,如果使用其它版本,处理方式也类似,主要是生成Entity的Fr ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第4章编程练习5

    #include <iostream>using namespace std;struct CandyBar{ char kind[20]; float weight; int calor ...

  6. vue环境配置 vue-cli脚手架

    vue 环境配置步骤: 第一步: 在官网下载node,Node  下载地址 http://nodejs.cn/ 并安装node.检测node是否安装成功, 按 “windows+r”  进入cmd命令 ...

  7. 常用的sort打乱数组方法真的有用?

    JavaScript 开发中有时会遇到要将一个数组随机排序(shuffle)的需求,一个常见的写法是这样: function shuffle(arr) { arr.sort(function () { ...

  8. leetcode笔记--SUM问题

    引用自 http://blog.csdn.net/wangxiaojun911/article/details/18922337,此处仅作为自己参考 1.Two SUM Given an array ...

  9. all to do list

    要做的任务: 1. docker 学习 2. python docker应用 3. python 异步爬虫 4. python 词云 5. Java根据代码自动生成接口文档(Swagger)  > ...

  10. [转]mysql使用关键字作为列名的处理方式

    转自:https://blog.csdn.net/xpnidaye/article/details/52388669 下面是一个创建表的语句,而其中key是一个关键字,所以不能直接写key. crea ...