show variables like '%sql_mode';  
show session variables like '%sql_mode%';  
show global variables like '%sql_mode%';  
  • 修改sql_mode
  • set global sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';
    set session sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';
    

    2.2 配置文件解决(永久修改)

    vim /etc/my.cnf修改最后面一行

    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
                                
    mysql:In aggregated query without GROUP BY, expression #1 of SELECT list contains...........

    原因是:当mysql的sql_mode存在only_full_group_by的时候,在不使用group by 并且select后面

    In aggregated query without GROUP BY...this is incompatible with sql_mode=only_full_group_by

    数据库查询时,出现如下错误:Caused by: com.mysql.jdbc.exceptions.jdbc4MyS

    ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregate

    mysql表结构如下:mysql> select * from fruits ;+------+------+------------+---------+| f_id | s_id | f_name | f_price |+------+------+------------+---------+| a1

    SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP

    SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP

    mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonagg

    mysql5.7执行sql语句报错:In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'yunva_changke.u.user_id'; this i...

    ERROR 1044 (42000) ERROR 1142 (42000): SELECT command denied to user ''@'localhost' for table 'user'

    ERROR: Access denied for user 'root'@'localhost' (using password: NO) 发现: mysql -u root@localhost -p 成功 mysql -u root -p 失败 mysql> SELECT user, host F...

    java 反射调用私有方法吗 java反射能不能调用private方法

    在java编程语言中,为了不让外界访问到类中某些属性和方法,通常将该属性或者方法有private修饰符来修饰。此时用正常的方式(对象名.属性名,对象名.方法名)将无法访问此属性与方法。 但是存不存在其他的方法来访问呢?答案肯定是存在的,这就是java反射带来的便利。 利用反射访问类的私有属性及方法如下:public class Student{ private String name;