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
解决方法一:
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
优点:不用重启mysql
缺点:重启mysql后还会出现标题错误
SELECT @@global.sql_mode;
查询全局的
@@session.sql_mode 当前回话的
上面的只是修改当前回话,需要修改全局的sql_mode
解决方法二
在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
注:sql_mode值用select @@sql_mode;查询出来后,将ONLY_FULL_GROUP_BY去掉剩余的值
优点:重启mysql 一次性解决问题
缺点:需要重启mysql
可以结合上述两种方案,来避免重启mysql服务,又能避免需要马上重启mysql
注:
my.cnf linux路径默认是/etc/my.cnf
在window下是my.ini