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

发布时间:2020-09-17 19:38:56 作者:鬾鬽鬿魀魁䰡
来源:脚本之家 阅读:247

最近使用 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: 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脚本的数据库的用户名" 它和 "数据库的登录用户名" 之间又有什么区别

<br><br>

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

推荐阅读:
  1. 怎样实现小程序的举报功能?
  2. 如何针对Thymeleaf模板抽取公共页面

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

springboot mysql 报错

上一篇:你不可不知的Vue.js列表渲染详解

下一篇:利用栈使用简易计算器(Java实现)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》