maven+springmvc出现:java.sql.SQLException: Unknown system variable 'query_cache_size'

连接mysql时一直出现以下的错误:

maven+springmvc出现:java.sql.SQLException: Unknown system variable 'query_cache_size'_第1张图片

 

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)




然后就将“
Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
 当做问题的根源去搜索答案(当然,一搜发现这种错误还是挺多的)但是并不是我想要的答案

后来看到控制台的信息:
java.sql.SQLException: Unknown system variable 'query_cache_size'
原来这才是问题的根源所在!!!

原因是mysql驱动的版本号不匹配!!!(这篇博客简直是救我于水深火热之中)
直接抄过来了
如果mysql驱动版本号不匹配的话会出现:
java.sql.SQLException: Unknown system variable 'query_cache_size'
java.sql.SQLException: Unknown system variable 'tx_read_only'
java.sql.SQLException: Unknown system variable 'language'

解决办法,到maven依赖查询 去找到你安装的mysql的版本对应的驱动版本号的配置

解决了这问题,又出现时区的问题,woc!!!

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

请移步至这篇博客

转载于:https://www.cnblogs.com/Guhongying/p/10679684.html

你可能感兴趣的:(数据库,java,网络)