无法创建/设置连接:未知系统变量 'query_cache_size'
P粉864872812
P粉864872812 2023-09-03 23:32:54
[MySQL讨论组]

我正在使用JDBC和MySQL运行应用程序,使用hikari池,但是由于以下错误无法构建:

","message":"HikariPool-1 - Starting..."}
{"timestamp":"16 Jun 2023 13:42:04,078","thread":"Timer-0","level":"DEBUG","logger":"com.zaxxer.hikari.pool.PoolBase","message":"HikariPool-1 - Failed to create/setup connection: Unknown system variable '
query_cache_size'"}
{"timestamp":"16 Jun 2023 13:42:04,078","thread":"Timer-0","level":"DEBUG","logger":"com.zaxxer.hikari.pool.HikariPool","message":"HikariPool-1 - Cannot acquire connection from data source","error.type":"
java.sql.SQLException","error.message":"Unknown system variable 'query_cache_size'","stack_trace":"java.sql.SQLException: Unknown system variable 'query_cache_size'\n\tat com.mysql.cj.jdbc.exceptions.SQLE
rror.createSQLException(SQLError.java:130)\n\tat com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)\n\tat com.mysql.cj.jdbc.ConnectionImpl.createNewIO(Conn
ectionImpl.java:825)\n\tat com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:446)\n\tat com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:239)\n\tat com.mysql.cj.jdbc.NonRegisteri
ngDriver.connect(NonRegisteringDriver.java:188)\n\tat com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:417)\n\tat com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:1
29)\n\tat com.mysql.cj.jdbc.MysqlDataSource.getConnection(MysqlDataSource.java:114)\n\tat com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:367)\n\tat com.zaxxer.hikari.pool.PoolBase.newPoolEntr
y(PoolBase.java:196)\n\tat com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)\n\tat com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)\n\tat com.zaxxer.hikari.pool.Hi
kariPool.<init>(HikariPool.java:115)\n\tat com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method
)\n\tat java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)\n\tat java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(D
elegatingConstructorAccessorImpl.java:45)\n\tat java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)\n\tat java.base/java.lang.reflect.Constructor.newInstance(Constructor.ja
va:480)\n\tat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)\n\tat org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.j
ava:117)\n\tat org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:311)\n\tat org.springframework.beans.factory.support.ConstructorResolver.autowireConstruct
or(ConstructorResolver.java:296)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)\n\tat org.springframew
ork.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFac
tory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)\n\
tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton
(DefaultSingletonBeanRegistry.java:234)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)\n\tat org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)\n\tat org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1707)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1452)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)\n\tat com.paytm.wallet.dao.manager.BeanManager.<clinit>(BeanManager.java:47)\n\tat com.paytm.wallet.dao.domain.PlatformManager.getAllPlatforms(PlatformManager.java:123)\n\tat com.paytm.wallet.dao.cache.PlatformCache.loadPlatformHashmap(PlatformCache.java:64)\n\tat com.paytm.wallet.dao.cache.PlatformCache$LoadPlatform.run(PlatformCache.java:46)\n\tat java.base/java.util.TimerThread.mainLoop(Timer.java:566)\n\tat java.base/java.util.TimerThread.run(Timer.java:516)\n"}

我已经按照以下方式更新了mysql版本和驱动程序,但仍然出现相同的错误:

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

jdbc驱动程序属性如下

jdbc.master.driver=com.mysql.cj.jdbc.Driver
#jdbc.master.driver=com.mysql.jdbc.Driver

jdbc.master.url=jdbc:mysql://localhost:6033/test

jdbc.master.maximumPoolSize=30

jdbc.master.dataSource.cachePrepStmts= true

jdbc.master.dataSource.prepStmtCacheSize= 250

jdbc.master.dataSource.prepStmtCacheSqlLimit= 2048

jdbc.master.connectionTimeout=250

jdbc.master.dataSource.useLocalSessionState=true

jdbc.master.dataSource.readOnlyPropagatesToServer=true

jdbc.master.dataSource.cacheServerConfiguration=true
`
jdbc.master.dataSource.characterEncoding=UTF-8

此外,mysql版本如下 |版本 | 8.0.31 | |版本评论 | MySQL 社区服务器 - GPL

P粉864872812
P粉864872812

全部回复(1)
P粉343408929

查询缓存已从8.0.xx中移除。因此,query_cache_%的几个变量不再可用。(Qc_%的状态值也已消失。)

任何涉及这些内容的第三方产品需要更新。

(“弃用”警告可能在几年前的5.7或8.0.0版本中已经给出。)

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号