Unknown system variable 'tx_isolation'] with root cause

场景

Spring Boot项目启动后运行提示:

Unknown system variable 'tx_isolation'] with root cause_第1张图片

详细如下:

### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'] with root cause

java.sql.SQLException: Unknown system variable 'tx_isolation'
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383) ~[mysql-connector-java-5.1.6.jar:na]
 at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3117) ~[mysql-connector-java-5.1.6.jar:na]
 at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:466) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:421) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:374) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) ~[HikariCP-3.2.0.jar:na]
 at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~

解决

找到pom.xml中mysql驱动的版本,升级即可。这里是5.1.6将其版本改高点即可。

Unknown system variable 'tx_isolation'] with root cause_第2张图片

你可能感兴趣的:(数据库)