网站建设资讯

NEWS

网站建设资讯

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

本篇内容介绍了“解决springboot连接MySQL时报错usingpassword:NO的方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创新互联公司为您提适合企业的网站设计 让您的网站在搜索引擎具有高度排名,让您的网站具备超强的网络竞争力!结合企业自身,进行网站设计及把握,最后结合企业文化和具体宗旨等,才能创作出一份性化解决方案。从网站策划到成都网站设计、成都做网站, 我们的网页设计师为您提供的解决方案。

最近使用 springboot 配置 mysql 时出现了一个错误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: rootdata-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脚本的数据库的用户名(如果有)。

“解决springboot连接mysql时报错usingpassword:NO的方法”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


本文题目:解决springboot连接mysql时报错usingpassword:NO的方法
转载注明:http://cdweb.net/article/jpddsj.html