MySQL异常:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nona...

[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

在navicat中使用mysql加索引或者删除索引时报了这个错。

两种解决方法:
1.暂时性解决

#查看SQL_MODE
SELECT @@sql_mode;

#修改SQL_MODE
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

2.一劳永逸
修改mysql目录下的my.ini 文件
如果不知道mysql路径了,可以在navicat中执行 SELECT @@datadir获取mysql安装路径

[mysqld]
#sql_mode
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

你可能感兴趣的:(Mysql)