mysql升级Caused by: com.mysql.jdbc.exceptions clause; this is incompatible with sql_mode=only_full_gr
Posted 威威dett
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql升级Caused by: com.mysql.jdbc.exceptions clause; this is incompatible with sql_mode=only_full_gr相关的知识,希望对你有一定的参考价值。
mysql由5.7.22升级5.7.25版本的时候报Err1055异常
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Expression #1 of ORDER BY clause is not in GROUP BY clause and contains
nonaggregated column 'callcenter.CREATETIME' which is not functionally
dependent on columns in GROUP BY clause; this is incompatible
with sql_mode=only_full_group_by
修复方法:
-
首先登陆mysql
mysql -uroot -p
-
登陆后使用命令
SELECT @@sql_mode;
,查看sql_mode
中确实有ONLY_FULL_GROUP_BY
mysql> SELECT @@sql_mode; +-------------------------------------------------------------------------------------------------------------------------------------------+ | @@sql_mode | +-------------------------------------------------------------------------------------------------------------------------------------------+ | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | +-------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
-
更改mysql的sql_mode
在
/etc/my.cnf
文件里加sql_mode
属性,值为上一步查询出来的,去掉ONLY_FULL_GROUP_BY
即可
如下:# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld] # # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # =====省略一部分内容===== # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # =============这里就是修改后的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' log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
-
重启Mysql服务就可以
service mysql restart
如果系统没有上面的重启命令
参考地址 https://blog.csdn.net/cx136295988/article/details/76690722
提示:
网上有些办法是用如下的sql指令去修改这个值,但是每次重启后会复原,只有修改my.cnf重启才有效果。
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
以上是关于mysql升级Caused by: com.mysql.jdbc.exceptions clause; this is incompatible with sql_mode=only_full_gr的主要内容,如果未能解决你的问题,请参考以下文章
dubbo升级到Apache的 2.7.7报错Caused by: java.io.IOException: invalid constant type: 18
我的Android进阶之旅解决Android Studio报错:Caused by: java.io.StreamCorruptedException: invalid type code: 00
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
Caused by com mysql jdbc MysqlDataTruncation Data truncati
MySQL异常:Caused by: com.mysql.jdbc.exceptions.MySQLTimeoutException: Statement cancelled due to timeo
连接mysql报错Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zon