mysql下this is incompatible with sql_mode=only_full_group_by解决方案
来源:互联网 发布:庆钰软件科技有限公司 编辑:程序博客网 时间:2024/06/05 21:16
本地测试没有问题,部署到客户服务器之后报如下错误:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘testID’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
这个错误的原因是高版本mysql(客户服务器版本是5.7.18)默认的sql_mode包含ONLY_FULL_GROUP_BY,这个属性保证了select到的列都在group by中出现。
查看sql_mode的语句如下:
select @@GLOBAL.sql_mode;
可以使用sql语句暂时修改sql_mode:
set @@GLOBAL.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数据库之后,ONLY_FULL_GROUP_BY又出现了,顺便写下重启数据库命令:
service mysqld stopservice mysqld start
所以需要修改mysql配置文件,通过手动添加sql_mode的方式强制指定不需要ONLY_FULL_GROUP_BY属性,my.cnf位于etc文件夹下,vim下光标移到最后,添加如下:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
重启后问题解决。
阅读全文
0 0
- mysql下this is incompatible with sql_mode=only_full_group_by解决方案
- this is incompatible with sql_mode=only_full_group_by
- this is incompatible with sql_mode=only_full_group_by
- this is incompatible with sql_mode=only_full_group_by
- MySQL Error this is incompatible with sql_mode=only_full_group_by
- mysql 5.7 this is incompatible with sql_mode=only_full_group_by 问题
- Mysql this is incompatible with sql_mode=only_full_group_by 异常
- 解决MySQL 5.7.9版本sql_mode=only_full_group_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 使用错误解决】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
- Jodd利器--开源Java微框架和工具
- 新手村 过程函数与递归 回文质数
- 2007年分区联赛提高组之一 统计数字
- hidapi在linux下编译总结
- 房钊的博客
- mysql下this is incompatible with sql_mode=only_full_group_by解决方案
- linux cp命令直接覆盖不提示按Y/N的方法
- NOIP 2017 Day2 总结
- JSONArray转list
- 树莓派:指令学习
- js SHA1加密
- Idea快捷键(一)-编辑操作
- 防火墙的配置————firewalld
- Linux查找软件安装路径以及查看Ubuntu版本