成都创新互联网站制作重庆分公司

解决springboot连接mysql时报错usingpassword:NO的方案

最近使用 springboot 配置 MySQL 时出现了一个错误

创新互联公司于2013年开始,先为迭部等服务建站,迭部等地企业,进行企业商务咨询服务。为迭部企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

Access denied for user ''@'localhost' (using password: YES) 或者
Access denied for user ''@'localhost' (using password: NO)

经发现这是 springboot 中 yml 语法的的一个坑,在我现在用的最新版本2.2.4 的springBoot中所推荐 yml 的格式是

data-username: root
data-password: 112233

就是前面加了 data- 的这种格式导致了这个错误,

单独使用 data-username 报错 using password: YES

如果使用 data-password 报错 using password: NO

后来查看源码发现,对于 username 和 password 的参数有一句这样的说明:Login username of the database./ Login password of the database.
而 data-username 和 data-password 的说明又有不同:

Username of the database to execute DML scripts (if different). / Password of the database to execute DML scripts (if different).
执行DML脚本的数据库的用户名(如果有)。

到这里问题已经很明显了, 什么叫 "执行DML脚本的数据库的用户名" 它和 "数据库的登录用户名" 之间又有什么区别



以上就是本次介绍的全部相关知识点内容,感谢大家的学习和对创新互联的支持。


网站栏目:解决springboot连接mysql时报错usingpassword:NO的方案
网页链接:http://cxhlcq.com/article/ipciog.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部