mysql 8解决group by 不支持

mysql5.7及以后的版本 select查询字段未出现在group by 中是会报错的  需要在命令行中执行以下命令:

这只是单次生效,重启Mysql后会失效,如果要永久生效需要修改my.cnf

set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

set @@session.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

 

by panhao 

posted @ 2020-02-01 13:46  WidgetBox  阅读(3400)  评论(0编辑  收藏  举报