记一次mysql升级成8.0后group by报错问题

mysql版本是8.0.012
升级后发现写个简单的group by语句都报错
sql:select * from table名 group by sex;

报错信息:
of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘fenxiangniu.stu.stuno’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

查了很多资料,命令行改不好改,不如直接修改配置文件。就是mysql安装目录下的my.ini文件(windos下)。在[mysqld]下加上如下语句
在这里插入图片描述
在这里插入图片描述
加上的内容为:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

发布了42 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_41935885/article/details/102757022