可以执行
SELECT
sid
FROM
sc
GROUP BY
sid
但是不可以执行
SELECT
*
FROM
sc
GROUP BY
sid
1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
此时只能:select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行。
解决办法1:这个只能是一次的,下次重启又恢复原来的样子
#启动mysql
mysql -u root -p
#输入以下命令,去掉ONLY_FULL_GROUP_BY
select version(), @@sql_mode;
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
#退出重启mysql服务即可
解决办法22:找到安装路径下my.ini文件,用note++打开
#在配置中加入这一行
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
然后重启mysql服务即可