在Navicat中执行SQL语句时,报以下错:
[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
解决方法一:
在MySQL中执行:
select version(),
@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY’,’’));
这个方法只能解决当前的,最佳答案还是用解决方法二。
解决方法二:
修改MySQL的配置文件 my.ini
,在[mysqld]
下面增加代码:
sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’
如图:
修改完my.ini文件后需要重启一下MySQL服务,如果是windows系统,则执行:net stop mysql
net start mysql