mysql8版本出现下面问题
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'msgList.lastContent' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
这个问题产生的原因是新版本的mysql不支持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_ENGINE_SUBSTITUTION';
一劳永逸的方法,重启mysql服务也不会失效,在mysql配置文件my.in里配置如下,再重启mysql服务
[mysqld]
sql_model=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION