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"/>
标签:zone,mysql,time,过高,版本,Mysql,server,com,### 来源: https://www.cnblogs.com/EthanLoveMath/p/15983382.html