Mysql 升级到 5.7.16,group by 一直报home brew on columns in GROUP BY clause; this is incompatible with sql
来源:互联网 发布:windows垃圾清理bat 编辑:程序博客网 时间:2024/06/03 20:04
Mysql 版本
➜ /etc mysql -vWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.7.16 HomebrewCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
错误信息
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'txdiag.agents.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决办法
复制配置文件 my-default.cnf to /etc/my.cnf 这里特别注意文件文件名一定要是my.cnf千万别改,且一定要放到etc文件夹下面
sudo cp $(brew --prefix mysql)/support-files/my-default.cnf /etc/my.cnfsudo vi /etc/my.cnf +31
删除掉原来的sql_mode=”…”,写入下面这句话即可
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
mysql.server restart
如果想要查看sql_mode是否配置成功,进入mysql执行下面命令即可show variables like '%sql_mode%'
➜ /etc mysql -u user -p passwordmysql> show variables like '%sql_mode%' -> ;+---------------+------------------------------------------------------------------------------------------------------------------------+| Variable_name | Value |+---------------+------------------------------------------------------------------------------------------------------------------------+| 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 row in set (0.01 sec)mysql> show variables like '%sql_mode%';+---------------+------------------------------------------------------------------------------------------------------------------------+| Variable_name | Value |+---------------+------------------------------------------------------------------------------------------------------------------------+| 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 row in set (0.00 sec)mysql>
0 0
- Mysql 升级到 5.7.16,group by 一直报home brew on columns in GROUP BY clause; this is incompatible with sql
- mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
- MySQL分组查询时出现错误SELECT list is not in GROUP BY ;this is incompatible with sql_mode=only_full_group_by
- SQL: GROUP BY Clause
- MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '
- #1055 - Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this i
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mysql命令gruop by报错this is incompatible with sql_mode=only_full_group_by
- mybatis模糊查询
- 项目中遇到的问题1
- 操作系统概念 -第七版-重要概念的理解-(34-40)
- iOS分析崩溃日志
- 对Session的访问进行同步
- Mysql 升级到 5.7.16,group by 一直报home brew on columns in GROUP BY clause; this is incompatible with sql
- mybatis 日期查询
- Apache Thrift入门学习
- 基于MyBatis3.0.6的基本操作介绍
- 如何搭建NET开发项目的框架——ABP框架
- HTML中name、id、class 的区别
- HashSet,TreeSet和LinkedHashSet的区别
- 【Qt】使用QPainter的drawPixmap()绘制多幅图片
- 未操作运算符