SpringBoot-错误-Access denied for user ''@'localhost' (using password: NO)

 

原因是数据库配置错误

 

错误配置:

#数据库配置spring.datasource.driver-class-name=com.mysql.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=falsespring.datasource.data-username=rootspring.datasource.data-password=123456

正确配置:

#数据库配置spring.datasource.driver-class-name=com.mysql.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=falsespring.datasource.username=rootspring.datasource.password=123456

关键:用户名与密码并没有“data-”,如果有将报错

相关文章