当前位置: 代码迷 >> 综合 >> Navicat报错[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clauseand contains nonaggr
  详细解决方案

Navicat报错[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clauseand contains nonaggr

热度:2   发布时间:2023-12-10 11:56:33.0

刚刚把Navicat安装好,新建了一个测试库,打算键个测试表,执行了建表语句,insert语句,SQL语句都执行了成功了,但是还是报错[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

这个时候,先去查sql_mode:

SELECT @@global.sql_mode;

查出来的结果开头就是:only_full_group_by

我们需要将only_full_group_by给去掉,我发现很多博客,要么是在Navicat里面执行

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

要么就是在window的命令窗口执行上面这个SQL。

这样做有效,但是当你重启服务MySQL服务后就会还是对报错的,永久有效的方法就是修改my.ini配置文件(mac系统则是my.cof)

修改完配置文件之后,重启MySQL服务,就不会报错了

更多sql_mode的知识,可以看下这个篇博客

https://www.cnblogs.com/cuixiaoying/p/11436167.html

  相关解决方案