mysql 8.0 java连接报错:Unknown system variable 'query_cache_size'

java连接mysql 8.0.11报错

java.sql.SQLException: Unknown system variable ‘query_cache_size‘
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1983)
at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1936)
at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422)
at com.mysql.cj.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:2831)
at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:2381)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:1739)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1596)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:633)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)

原因是mysql-connector-java的版本还是6.0.6,需要升级版本到8.0.11 ,这个报错就不存在了

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

mysql 8.0 java连接报错:Unknown system variable 'query_cache_size'

原文地址:https://www.cnblogs.com/testway/p/9013285.html

时间: 2024-10-25 14:18:05

mysql 8.0 java连接报错:Unknown system variable 'query_cache_size'的相关文章

java.sql.SQLException: Unknown system variable &#39;query_cache_size&#39;

Jar包版本不对: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.40</version> </dependency> 换个版本就好了: <dependency> <groupId>mysql</groupId> <arti

jira安装报错 Unknown system variable &#39;default_storage_engine&#39;

公司要使用BUG管理系统,所以对比了一下,最后决定安装jira. 安装后要在网页端,配置数据库,本地数据库是5.1的版本,一直有报错Unknown system variable 'default_storage_engine',在往上查询无果,my.ini设置也没用.把数据库远程连接到一个linux下的5.6版本就正常,最后决定安装5.6版本数据库. 问题解决.有些也是没办法的事情. jira安装报错 Unknown system variable 'default_storage_engin

Unknown system variable &#39;query_cache_size&#39; 错误原因以及解决办法

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unknown system variable

Hibernate卡住,然后报错java.sql.SQLException: Unknown system variable &#39;language&#39;异常

启动应用的时候会卡在: 08:22:58,221 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator]. 08:22:58,226 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.secure.spi.JaccIntegrator]. 08:22:

JDBC报错 消息 Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

今天用JDBCTemplate时,发现启动服务器之后报错: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'. 网上说是因为MySQL版本过高的问题,我的MySQL版本是8.0,里面已经没有tx_isolation,变成了transaction_isolation,用了以下几种解决方法: (1)更改MySQL  无效,仍然

解决MySQL8.0报错:Unknown system variable &#39;validate_password_policy&#39;

一.问题描述 1.在安装MySQL8.0时,修改临时密码,因密码过于简单(如:123456),不符合MySQL密码规范,会触发一个报错信息: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements. 二.遇到问题 1.解决办法调整MySQL密码验证规则,修改 policy 和 length 的值. 2.MySQL 5.7 进行如下设置,即可解决问题: mysql>  set global

native 链接 mysql 8.0以上版本 报错2059

MySQL版本是8.0.4  由于新版本的MySQL新特性导致的. mysql> select Host,User,plugin from mysql.user; +-----------+------------------+-----------------------+ | Host | User | plugin | +-----------+------------------+-----------------------+ | localhost | mysql.infoschem

解决问题:java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

是因为MySQL版本高但驱动jar包的版本太低, 因此将mysql-connector-java升级到最新版本就解决了问题: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.17</version></dependency> 但紧接着又发现报错: 在数据库连接配置文件

解决 sqlalchemy 报错:(1193, &quot;Unknown system variable &#39;tx_isolation&#39;&quot;)

1出现此报错的原因是使用的mysql8.0 以前用的是:tx_isolation 现在用是: transaction_isolation a.通过升级 sqlalchemy 的方法可以解决此问题, pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade sqlalchemy --ignore-installed(亲测有效————) b.通过降低,mysql 版本来解决这个问题. 解决 sqlalchemy 报错:(119