mysql版本升级为5.7.17,线下用的5.6版本,group by 报错处理
2017-04-20 00:00
633 查看
线上用的mysql版本为5.7.17,线下用的5.6版本,发现将程序上线后,有些地方报这个错误
[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
解决办法下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 中去掉only_full_group_by
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';
mysql> select @@sql_mode;
然后重启MySQL Server即可。
service mysqld restart
[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
解决办法下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 中去掉only_full_group_by
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';
mysql> select @@sql_mode;
然后重启MySQL Server即可。
service mysqld restart
相关文章推荐
- mysql 5.5和5.6版本关于timestamp not null类型字段关于null的处理
- mysql 5.6到percona 5.6小版本升级
- 升级 phpStudy 中 MySQL 版本至 5.7.17
- phpStudy中升级MySQL版本到5.7.17的方法步骤
- CentOS6.x升级MySQL版本5.1到5.6
- MySQL版本升级5.6到5.7版本
- MySQL 5.6升级至MySQL 5.7--------版本升级最佳实战
- MySQL5.7.17版本使用innobackupex copy back恢复之后启动报错处理
- centos yum升级到mysql 5.6 指定版本 平滑升级
- Centos 升级MySQL版本或者Yum安装Mysql5.6
- MySQL版本升级之5.6到5.7
- CentOS6/7下MySQL版本升级到5.6或 5.7实践
- phpStudy中升级MySQL版本到5.7.17的方法步骤
- CentOS6.x升级MySQL版本5.1到5.6
- MySQL 5.6版本GTID复制异常处理一例
- MySQL版本升级之5.6到5.7
- mysql 5.5和5.6版本关于timestamp插null和0的处理
- mysql 5.5升级5.6以上版本
- 升级 phpStudy 中 MySQL 版本至 5.7.17
- mysql 5.5和5.6版本关于timestamp插null和0的处理