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

发布时间 2023-09-25 11:23:35作者: MaskerFan

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

 

解决方法一:

SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); 

优点:不用重启mysql

缺点:重启mysql后还会出现标题错误

 

SELECT @@global.sql_mode;

查询全局的

@@session.sql_mode 当前回话的

上面的只是修改当前回话,需要修改全局的sql_mode

解决方法二

在my.cnf中修改

[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

注:sql_mode值用select @@sql_mode;查询出来后,将ONLY_FULL_GROUP_BY去掉剩余的值

优点:重启mysql 一次性解决问题

缺点:需要重启mysql

 

可以结合上述两种方案,来避免重启mysql服务,又能避免需要马上重启mysql

注:

my.cnf linux路径默认是/etc/my.cnf

在window下是my.ini

 
分类: mysql
0
0
 
 
 
« 上一篇: linux 查找指定大小以上的文件
» 下一篇: _init_() got an unexpected keyword argument ‘shape’
posted @ 2018-10-12 11:31  苍洱  阅读(4116)  评论(0编辑  收藏  举报