完美解决,lnmp环境mysql,group by报ERROR 1055(42000)错误!

环境:

一键安装包lnmp,mysql版本5.7.18-log

查询:

group by

报错信息:

ERROR 1055 (42000): Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘s.type_name’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

解决方案:

打开/etc/my.cnf配置文件

[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服务,再次执行sql语句,完美解决了!

你可能感兴趣的:(服务器,数据库)