Mysql升级到8.0后,原有的sql出现了报错情况。错误提示如下:
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'poi2.b.province' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
1、方式一
# 注意:服务重启后需要重新执行
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
2、方式二(修改my.ini)
[mysqld]
basedir=D:/001ENV/mysql # 设置 MySQL 安装文件夹,默认是 mysqld.exe 的上级目录,一般无需设置
datadir=D:/001ENV/mysql/data # 设置 data 文件夹。如果你没改过 data 目录的位置,那无需设置该项
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION #注意要移除:ONLY_FULL_GROUP_BY,或者直接设置sql_mode为空