java.sql.SQLException: Unknown system variable 'query_cache_size'

java.sql.SQLException: Unknown system variable 'query_cache_size'
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2504)
    at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1370)
    at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3861)
    at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3289)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2298)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084)
    at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:795)
    at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:44)
    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:404)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:247)
image.png

错误分析

以上错误是因为mysql是8.0版本 而我的数据库驱动是5.0版本,所以匹配不上,所以下载8.0版本的数据库驱动
https://dev.mysql.com/downloads/connector/j/

mysql版本 - 8.0.12

image.png

你可能感兴趣的:(java.sql.SQLException: Unknown system variable 'query_cache_size')