Java 连接MySQL 8.0.11 连接不上的问题

这几天用上了Ubuntu 18.04后,下载了MySQL最新版(8.0.11) 在运行调试之前的项目时,发现mybatis一直报错

错误如下:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The connection property 'zeroDateTimeBehavior' acceptable values are: 'CONVERT_TO_NULL', 'EXCEPTION' or 'ROUND'. The value 'convertToNull' is not acceptable.)
### The error may exist in file [/home/xxx/桌面/studenthelper-master/target/classes/mapping/xxx.xml]
### The error may involve com.xx.Dao.xxDao.login
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The connection property 'zeroDateTimeBehavior' acceptable values are: 'CONVERT_TO_NULL', 'EXCEPTION' or 'ROUND'. The value 'convertToNull' is not acceptable.)

经过查询得到是配置文件的问题,在8.0.11的MySQL中,jdbc.properties中的配置和原来不一样

driverClasss=com.mysql.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8

需要改成(test为数据库名)

driverClasss=com.mysql.cj.jdbc.Driver
jdbcUrl=jdbc:mysql://localhost/test?useSSL=FALSE&serverTimezone=UTC

另外驱动也需要下载最新版
maven项目需要在pom.xml中修改版本号

你可能感兴趣的:(problem)