升级mysql后,运行程序报错
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘......’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
尝试了如下方法:
1、修改my-default.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
重启mysql,无用
2、在Navicat里执行
①
select @@global.sql_mode; 查看结果确实含有only_full_group_by
执行
set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
当时有用,但再打开一个窗口,执行select @@global.sql_mode; 查看结果仍然含有only_full_group_by
②
SHOW VARIABLES LIKE '%sql_mode%';
set sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
当时有用,但再打开一个窗口,执行SHOW VARIABLES LIKE '%sql_mode%'; 查看结果仍然含有only_full_group_by
3、成功的方法!嘻嘻嘻!
参考/post/475.html