[Err] 1055 - Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘t_shenzhou.pbo.publish_result’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
有的网站的解决方案是:但是没生效
命令:(但是没生效)
set @@GLOBAL.sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION;
或者my.ini设置:
在 [mysqld] 下面添加代码:(但是没生效)
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
又去找了其他网站:(此网站有效)
https://www.cnblogs.com/fireporsche/p/8618691.html
大致方案是:
第一种:
set sql_mode=(select replace(@@sql_mode,‘ONLY_FULL_GROUP_BY’,’’)); 可以使用该语句来将空格替换掉
第二种:
set @@sql_mode=STRICT_TRANS_TABLES;
第三种:
也可以通过配置文件设置:vim /etc/my.cnf
在my.cnf(my.ini)添加如下配置:
[mysqld]
sql_mode=‘你想要的模式’