mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程。
我的情况 :
Mysql 5.7.21 版本运行sql 报错如题,同样的 sql 直接本地运行不报错。
但是当连接的是服务器上的 Mysql 时出现这个报错(即使是运行一个最简单的 select * from 表)。
以下解决方法转自 :https://blog.csdn.net/u014520745/article/details/76056170
在用mysql执行如下查询的时候:
select * from `sys_user_group` group by `GROUP_ID`
- 1
报错信息如下:
[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
错误的原因是我mysql版本是5.7的,使用如下语句查询可知
select @@sql_mode;
- 1
里面默认设置了
sql_mode=only_full_group_by
- 1
only_full_group_by
:使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行,其实这个配置目前个人感觉和distinct差不多的,所以去掉就好
直接修改mysql配置文件(我的系统是Ubuntu16.04的,在/etc/mysql/mysql.conf.d/mysqld.cnf
中并没有sql_mode这个配置,所以直接加上就好,如果是其他系统有得修改就不用添加了)
[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
- 1
到此mysql配置文件的完整配置如下:
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
lower_case_table_names=1
character-set-server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by相关推荐
- 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 ...
- mysql查询报错2014_mysql Hibernate 查询时用别名报错
mysqlHibernate查询时用别名报错在mysql查询工具中,能正常执行SQL:SELECTROLE_IDASVALUE,SNAMEASTESTFROMSYS_ROLEORDERBYROLE_I ...
- node.js 中Mysql 查询报错 ,解决方法。
1.报错: throw err; // Rethrow non-MySQL errors 2.问题出处 mysql\lib\protocol\Parser.js:437 抛出异样,try..catch ...
- MySQL查询报错Unknown column ‘new_edition‘ in ‘IN/ALL/ANY subquery‘
报错SQL如下 SELECTse.`name`,se.icon_path,se.experiment_path,se.complete_edition,CAST( REPLACE ( se.compl ...
- MySQL查询报错ERROR:No query specified
出现此错误是sql不合法原因: \G后面不能再加分号;,因为\G在功能上等同于;,如果加了分号,那么就是;;(2个分号),SQL语法错误
- mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column.
mysql使用group by查询报错SELECT list is not in GROUP BY clause and contains nonaggregated column. 出现原因 使用g ...
- MySQL报错1055解决办法:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
[mysql报错1055 报错解决办法][Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and cont ...
- mysql not in报错_mysql从5.7升级到8.0查询报错Expression #2 of SELECT list is not in GROUP BY...
报错信息: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sss. ...
- mybatis查询报错:com.mysql.cj.exceptions.DataConversionException: Cannot determine value type from string
mybatis查询报错: com.mysql.cj.exceptions.DataConversionException: Cannot determine value type from strin ...
最新文章
- 手把手教你React(一)JSX与虚拟DOM
- 目录管理,创建、删除、移动目录,创建、删除、移动文件
- 深度学习-吴恩达-笔记-6-优化算法
- 免费下载百度文库文档、免注册、免登录、免财富值 - 帮手网-云下载
- iredmail mysql_centos 7搭建邮件服务器iRedMail
- MATLAB高维矩阵的求和、索引
- oracle修改sql域名,oracle更改数据库权限
- 配置:生产计划参数文件
- Java中Flie类的用法
- Rust包管理 Crate
- 在线文档编辑插件——KindEditor
- win7系统蓝屏故障以及常见的解决方案
- 【观察】大数据3.0新时代 星环科技的思与行
- Java--对象的比较2(类比)
- 驰为v10刷linux,V10HD强势回归 3G双系统聚划算首发
- MyBatis-Plus自动填充字段(创建时间、修改时间、uuid等)
- 什么是无代码平台 无代码平台开发的优势
- 实用的多人配音教学,轻松为视频配音
- 如何安装MySQL解压缩版
- 韦东山FreeRtos的内部机制,截图+学习笔记【2000字】【原创】
热门文章
- ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'
- bi 存储过程方案_BI 系统中容易被忽视的数据源功能
- python输入城市名称_python 查询天气(输入城市名,输出天气)
- 开机cpu风扇声音大_联想拯救者R720笔记本,开机显示暗屏,二修机多故障完美修复...
- 一篇关于Qt开发技巧的文章收藏
- REVERSE-PRACTICE-JarvisOJ-1
- 【git下载安装与配置】
- CCIE-LAB-第十六篇-NAT+OSPF下发默认路由+校验配置(模块一结束篇章)
- 【NOIP2013积木大赛,NOIP2018铺设道路】积木大赛(思维,贪心)
- 【CodeForces - 1A】Theatre Square(水题,几何)(CODEFORCES,梦的开始)