详细错误:
1 java.sql.SQLException: Unknown system variable ‘query_cache_size‘ 2 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959) 3 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870) 4 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806) 5 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470) 6 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617) 7 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546) 8 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504) 9 at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1370) 10 at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3861) 11 at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3289) 12 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2298) 13 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084) 14 at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795) 15 at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) 16 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 17 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 18 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 19 at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 20 at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) 21 at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400) 22 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) 23 at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175) 24 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220) 25 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206) 26 at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203) 27 at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138) 28 at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125) 29 at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44) 30 at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870) 31 at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
原因:mysql驱动版本过低,更换驱动版本
<!-- mysql --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.16</version> </dependency>