问题:通过 GROUP BY 查询时抛出下列异常
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #19 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.s.download_add' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决方法:
- 1.在
my.cnf
中加入sql_model = ""
sudo vim /etc/my.cnf
-
2.重启mysql
启动MySql服务:
sudo /usr/local/mysql/support-files/mysql.server start停止MySql服务:
sudo /usr/local/mysql/support-files/mysql.server stop重启MySql服务:
sudo /usr/local/mysql/support-files/mysql.server restart
网友评论