一、问题描述
在使用MySQL查询时报了一个没有见过的错误:
[Err] 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
二、解决方法
在windows环境下,MySQL的安装路径中有一个my.ini文件,在里面加入以下内容:
(一定要在[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
在虚拟机环境下的/etc/my.cnf
配置文件的[mysqld] 下添加以下内容:
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
然后在MySQL的bin目录下输入service mysqld restart
重启MySQL即可
来源地址:https://blog.csdn.net/weixin_43520450/article/details/129559107