zoukankan      html  css  js  c++  java
  • MySQL5.7.21报错:[Err] 1055

    [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> 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_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
    +-------------------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)

    mysql> SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
    Query OK, 0 rows affected (0.00 sec)

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

    修改my.cnf,添加:

    sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

    only_full_group_by :使用这个就是使用和oracle一样的group  by规则, select的列都要在group by中,或者本身是聚合列(SUM,AVG,MAX,MIN)

  • 相关阅读:
    4、路由事件 RoutedEvent
    3、Grid、GridSplitter 网格分离器、SharedSizeGroup 共享尺寸组
    2、DockPanel
    1、布局容器Grid、StackPanel、GroupBox、DockPanel、WrapPanel
    15、Qt 样式表
    14、SpinBox与Horizontal Scroll Bar
    13、Qt界面布局
    12、label控件
    11、LineEdit与setCompleter自动补全
    Linux设备模型 (2)
  • 原文地址:https://www.cnblogs.com/elontian/p/8708891.html
Copyright © 2011-2022 走看看