学无止境学无止境

I am a slow walker,
but I never walk backwards.

MySql中only_full_group_by的问题解决

首先查看mysql的sql_mode:

mysql> select @@sql_mode;
+----------------------------------------------------------------------------------------------------+
| @@sql_mode                                                                                         |
+----------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION |
+----------------------------------------------------------------------------------------------------+
1 row in set (0.25 sec)

可以看到ONLY_FULL_GROUP_BY,我们需要关闭它。

vi /etc/mysql/conf.d/custom.cnf

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
#没有only_full_group_by

最后重启mysql。

本原创文章未经允许不得转载 | 当前页面:学无止境 » MySql中only_full_group_by的问题解决

评论 1

  1. 我去,网管哥,终于又找到你的站了~

    a 2019-12-21    回复