首页> 开发问题 >后端问题 后端问题

MYSQL5.7版本sql_mode=only_full_group_by报错解决方案

作者:小萝卜 2019-06-18 浏览 2026

简介报错如下:SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'qdm67352293_db.ueo76_article.dates' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

之前一直用的是5.6版本的mysql,最近升级到5.7.9之后之前运行挺正常的项目报错:which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by。经过网上一番查找,解决如下:

我的mysql是部署在linux上的,修改/etc/my.cnf文件:

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER

关键是得有这个NO_AUTO_CREATE_USER,修改后重启mysql,运行正常。

 

 

很赞哦! (0)

文章评论

    高端网站建设