mysql版本升级为5.7.17,线下用的5.6版本,group by 报错处理


线上用的mysql版本为5.7.17,线下用的5.6版本,发现将程序上线后,有些地方报这个错误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_bysql


解决办法下my.cnf中添加如下几行this

[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'rest

在sql_mode 中去掉only_full_group_byorm

mysql> 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';it

mysql> select @@sql_mode; io


而后重启MySQL Server便可。function

service mysqld restartform

相关文章
相关标签/搜索