ORDER BY clause is not in GROUP BY.this is incompatible with sql_mode=only_full_group_by 异常分析解决

Posted mask哥

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORDER BY clause is not in GROUP BY.this is incompatible with sql_mode=only_full_group_by 异常分析解决相关的知识,希望对你有一定的参考价值。

1.分析异常原因:mysql版本导致 mysql sql_mode不支持only_full_group_by

2.分析解决过程:

查看sql_mode

SELECT @@sql_mode;

去掉ONLY_FULL_GROUP_BY,重新设置值

SET @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

修改MySQL配置文件

Linux下my.cnf或Windows下My.ini

[mysqld]

sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

mysql 重启:

systemctl restart mysql.service   或者 service mysqld restart

以上是关于ORDER BY clause is not in GROUP BY.this is incompatible with sql_mode=only_full_group_by 异常分析解决的主要内容,如果未能解决你的问题,请参考以下文章

1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contai

linux下order by 报出ORDER BY clause is not in SELECT list

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

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

[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated

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