SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP

这是完整的报错

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘9mupc.wu_user.USERNAME’ 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, 使用了View进行了表连接, 进行了表连接

搬迁到本地后, 查询报错 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,就好了。
来源:https://blog.csdn.net/weixin_43719586/article/details/102822179

你可能感兴趣的:(SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP)