linux环境下安装的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服务

cd /home/mysql/mysql-5.7.22-linux-glibc2.12-x86_64/support-files

./mysql.server restart

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

你可能感兴趣的:(数据库)