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

Posted 碰到什么写什么

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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-”,如果有将报错

以上是关于SpringBoot-错误-Access denied for user ''@'localhost' (using password: NO)的主要内容,如果未能解决你的问题,请参考以下文章

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

springboot java.sql.SQLException: Access denied for user ''@'localhost' (using pass

无法上传文件出现550 Access is denied错误

docker上传镜像错误:errors: denied: requested access to the resource is denied unauthorized: authentication

npm permission denied错误npm ERR! Error: EACCES: permission denied, access

MySql access denied for user错误