关于mysql发生[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.报错的解决方法

今天在使用Navicat创建新表是出现以下错误:

[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

本人使用的是mysql版本是 8.0.20

创建新表的时候,新表是创建成功了的,但是发生了以上报错。尝试创建其他表也会出现同样的问题。

解决方法:

通过运行以下命令查询sql_mode的值

select @@sql_mode;

可以发现sql_mode的值为ONLY_FULL_GROUP_BY;

然后运行以下命令更改sql_mode的值:

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

运行完毕后再次查询sql_mode的值,此时应该已经改变了。

再次尝试创建新表,已经不会报错了,问题解决。

 

posted on 2020-08-12 15:36  SilenceAries  阅读(415)  评论(0)    收藏  举报

导航