Springboot整合Mybatis进行单元测试连接数据库时报错

问题描述:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

项目的/src/main/resources/application.properties的文件内容如下:

mybatis.config-locations=classpath:mybatis/mybatis-config.xml
mybatis.mapper-locations=classpath:dao/*.xml
mybatis.type-aliases-package=com.pblog.domain

spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/pblog?useUnicode=true&characterEncoding=utf-8&useSSL=true
spring.datasource.username =root
spring.datasource.password =Root

出错原因:spring.datasource.password =Root  (密码Root后面多了一个空格)。

猜你喜欢

转载自blog.csdn.net/weixin_40550726/article/details/81411653
今日推荐