springboot +mybatis-plus(让人无语的错)
Access denied for user ‘‘@‘localhost‘ (using password: NO)

找了好多资料才发现坑(坑死我了!)
我的数据库配置
spring.datasource.data-username=root
spring.datasource.data-password=root
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis-plus?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=CST
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
username与password的前面都加了 data-,这是根据自动补全写的,这样写会就报错:Access denied for user ''@'localhost' (using password: NO)
正确配置如下、
#数据库链接
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc:mysql://localhost:3306/mybatis-plus?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=CST
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

完美解决!!

浙公网安备 33010602011771号