Unable to create/set up connection: Unknown system variable 'query_cache_size'
P粉864872812
P粉864872812 2023-09-03 23:32:54
0
1
610
<p>我正在使用JDBC和MySQL运行应用程序,使用hikari池,但是由于以下错误无法构建:</p> <pre class="brush:php;toolbar:false;">&quot;,&quot;message&quot;:&quot;HikariPool-1 - Starting...&quot;} {&quot;timestamp&quot;:&quot;16 Jun 2023 13:42:04,078&quot;,&quot;thread&quot;:&quot;Timer-0&quot;,&quot;level&quot;:&quot;DEBUG&quot;,&quot;logger&quot;:&quot;com.zaxxer.hikari.pool.PoolBase&quot;,&quot;message&quot;:&quot;HikariPool-1 - Failed to create/setup connection: Unknown system variable ' query_cache_size'&quot;} {&quot;timestamp&quot;:&quot;16 Jun 2023 13:42:04,078&quot;,&quot;thread&quot;:&quot;Timer-0&quot;,&quot;level&quot;:&quot;DEBUG&quot;,&quot;logger&quot;:&quot;com.zaxxer.hikari.pool.HikariPool&quot;,&quot;message&quot;:&quot;HikariPool-1 - Cannot acquire connection from data source&quot;,&quot;error.type&quot;:&quot; java.sql.SQLException&quot;,&quot;error.message&quot;:&quot;Unknown system variable 'query_cache_size'&quot;,&quot;stack_trace&quot;:&quot;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&quot;}</pre> <p>我已经按照以下方式更新了mysql版本和驱动程序,但仍然出现相同的错误:</p> <pre class="brush:php;toolbar:false;"><dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.33</version> </dependency></pre> <p>jdbc驱动程序属性如下</p> <pre class="brush:php;toolbar:false;">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</pre> <p>此外,mysql版本如下 |版本 | 8.0.31 | |版本评论 | MySQL 社区服务器 - GPL</p>
P粉864872812
P粉864872812

reply all(1)
P粉343408929

Query cache has been removed from 8.0.xx. Therefore, several variables of query_cache_% are no longer available. (The status value of Qc_% has also disappeared.)

Any third-party products involving these content need to be updated.

(The "deprecation" warning may have been given in version 5.7 or 8.0.0 a few years ago.)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template