SpringBoot-错误-Access denied for user ''@'localhost' (using password: NO)
原因是数据库配置错误
错误配置:
#数据库配置 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false spring.datasource.data-username=root spring.datasource.data-password=123456
正确配置:
#数据库配置 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false spring.datasource.username=root spring.datasource.password=123456
关键:用户名与密码并没有“data-”,如果有将报错