this is incompatible with sql_mode=only_full_group_by
this is incompatible with sql_mode=only_full_group_by 报错
this is incompatible with sql_mode=only_full_group_by 报错
2018-08-16
中午的时候服务器抛了一个异常:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'blog.log.brower' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
就按网上的方法:
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,又给还原了,这不是办法。
于是就在配置文件(/etc/my.cnf)的[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
问题解决!
举报