详细信息 您现在的位置是:首页 > php
更换服务器后分组group语句报错,关闭ONLY_FULL_GROUP_BY
来源:
发布时间:2022-10-21
547 人已围观
摘要更换服务器后分组group语句报错,SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY。关闭ONLY_FULL_GROUP_BY模式
报错:
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'card20.o.OrderTime' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
mysql版本是5.7.26, 使用了group分组, 进行了表连接
搬迁到本地后, 查询报错 Syntax error or access violation: 1055 Expression
解决方法:
向my.ini的[mysqld]下增加配置:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
重启mysql,就好了。
站点信息
- 电话:15226178738
- QQ:1697915848
- 邮箱:1697915848@qq.com