项目升级mysql 到5.7.29 运行程序报错如下:
- Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'jmr_maintenance.mt_burst_warn.WARN_TYPE' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
- at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
- at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
- at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
- at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
- at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
- at com.mysql.jdbc.Util.getInstance(Util.java:408)
- at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
- at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
- at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
- at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495)
- at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
- at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1242)
- at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:498)
- at org.apache.ibatis.executor.statement.PreparedStatementHandle
修改my.cnf
locate my.cnf
查看设置结果
select @@GLOBAL.sql_mode;