Could not get JDBC Connection连接数据库报错

 1 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
 2  
 3 ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'woshin'@'localhost' (using password: YES))
 4  
 5 ### The error may exist in ssm/mapper/ItemsMapper.xml
 6  
 7 ### The error may involve ssm.mapper.ItemsMapper.selectByPrimaryKey
 8  
 9 ### The error occurred while executing a query
10  
11 ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested

 

需要查看pom.xml db.properties
尝试做如下修改:
1、版本问题,尝试修改版本 8.0.15
 
    mysql
    mysql-connector-java
    8.0.15
 
2、更改db.properties
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/mydb?rewriteBatchedStatements=true&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&useSSL=false
jdbc.username=root
jdbc.password=123456
备注:记得路径问题
posted @ 2021-02-03 11:57  贩卖人烟  阅读(1763)  评论(0编辑  收藏  举报