1.临时生效
#查看 #1 show variables like '%sql_mode%'; #2 SELECT @@GLOBAL.sql_mode; #3 SELECT @@SESSION.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'; set @@SESSION.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';
2.永久生效
sql命令 查询 sql_mode设置
show variables like '%sql_mode%';
将查询sql_mode的结果去除only_full_group_by配置到下边文件内
找到mysql的配置文件 my.ini/my.cnf
添加配置
# 关闭ONLY_FULL_GROUP_BY
sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
重启mysql