[mysql][问题记录]java.sql.SQLException: Unknown system variable 'query_cache_size'

问题:

java.sql.SQLException: Unknown system variable 'query_cache_size'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545) ~[mysql-connector-java-6.0.6.jar:6.0.6]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513) ~[mysql-connector-java-6.0.6.jar:6.0.6]

分析:

pom依赖版本:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>6.0.6</version>
</dependency>

数据库版本:8.0.28

 

有解释说 :

The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0. Deprecation includes query_cache_size.

意思是query cache在MySQL5.7.20已经过时,而在MySQL8.0之后被移除。

 

解决:

获取支持的依赖(当前最新为8.0.28):

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
上一篇:使用 redis-shake 迁移 redis-cluster集群


下一篇:[RabbitMQ--1] MQ简介