mysql 8.0.1 提示1055错误。only_full_group_by问题

转:https://blog.csdn.net/zht741322694/article/details/82743832

[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

原因分析:

only_full_group_by :使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行。5.6版本中没有这约束。更高版本就有这个问题了。去掉就可以了。

解决方式:

登录mysql -->  mysql -u root -p

输入密码 --> 123456

执行:select version(), @@sql_mode;  出现如下信息

mysql> select version(),@@sql_mode;
+-----------+-------------------------------------------------------------------
----------------------------------------------------+
| version() | @@sql_mode
                                                    |
+-----------+-------------------------------------------------------------------
----------------------------------------------------+
| 8.0.12    | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DAT
E,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+-----------+-------------------------------------------------------------------
----------------------------------------------------+
1 row in set (0.00 sec)

再次执行:

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

把ONLY_FULL_GROUP_BY去掉。

退出重启mysql服务--> mysqld restart

问题解决。
 

你可能感兴趣的:(mysql 8.0.1 提示1055错误。only_full_group_by问题)