Linux系统下部署MySql时,mysql5.7不支持group by

mysql使用group by 的时候报错,错误信息如下:

1055:ER_WRONG_FIELD_WITH_GROUP: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated
column 'lbparking.tradingrecord.pname' which is not functionally dependent on columns in GROUP BY clause;
this is incompatible with sql_mode=only_full_group_by

解决步骤:

一、找到/etc/my.cnf
二、添加如下语句: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服务
service mysqld stop
service mysqld start

备注:上述解决操作在root账号下进行

发布了16 篇原创文章 · 获赞 0 · 访问量 5060

猜你喜欢

转载自blog.csdn.net/jianwen_tian/article/details/103747832