zoukankan      html  css  js  c++  java
  • mysql5.7 异常ERROR 1055 (42000)

    大致错误如:ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'aaa.test.age' which is not functionally dependent on columns in GROUP BY clause;
    this is incompatible with sql_mode=only_full_group_by

    一般是执行类似如下语句报错:

      mysql> select * from customers group by age;

    解决方法:

    1、登陆mysql服务器,执行以下两条命令,在global与session级都修改;

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


    2、同时,在my.cnf文件的[mysqld]字段中,指定sql_mode的值:

     [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

    以上两种方法同时执行后,不用重启mysql

  • 相关阅读:
    python 之os模块用法大全
    web自动化测试常用的定位方式有哪些?
    Jenkins
    吴恩达机器学习笔记:如何debug一个学习算法?
    贝叶斯网络
    leetcode-32. Longest Valid Parentheses
    leetcode4 median Of two sorted array
    leetcode21
    vs2017问题集锦
    LIS
  • 原文地址:https://www.cnblogs.com/weiyiming007/p/10025181.html
Copyright © 2011-2022 走看看