MySql教程

Mysql版本过高的一些问题

本文主要是介绍Mysql版本过高的一些问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

mysql服务使用的是

Server version: 8.0.27 MySQL Community Server - GPL

遇到的一些问题总结一下

 

1  驱动版本过低问题

mysql-connector-java-5.1.37-bin.jar  版本 会遇到  Could not create connection to database server.

 

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
### The error may exist in com/demo/dao/UserMapper.xml
### The error may involve com.demo.dao.UserMapper.findAll
### The error occurred while executing a query
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

 

 

 

2  时区问题

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
### The error may exist in com/demo/dao/UserMapper.xml
### The error may involve com.demo.dao.UserMapper.findAll
### The error occurred while executing a query
### Cause: java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

解决办法  : 

库名称后添加   ?serverTimezone=GMT%2B8
         %2B8表示时间移动到东八区  
<property name="url" value="jdbc:mysql://地址:端口号/库名称?serverTimezone=GMT%2B8"/>
这篇关于Mysql版本过高的一些问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!