解决springboot 连接 mysql 时报错 using password: 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: 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>
上一篇:ArrayList和HashMap如何自己实现实例详解
栏 目:JAVA代码
下一篇:JDBC数据源连接池配置及应用
本文标题:解决springboot 连接 mysql 时报错 using password: NO的方案
本文地址:http://www.codeinn.net/misctech/131458.html


阅读排行
- 1Java Swing组件BoxLayout布局用法示例
- 2java中-jar 与nohup的对比
- 3Java邮件发送程序(可以同时发给多个地址、可以带附件)
- 4Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Type异常
- 5Java中自定义异常详解及实例代码
- 6深入理解Java中的克隆
- 7java读取excel文件的两种方法
- 8解析SpringSecurity+JWT认证流程实现
- 9spring boot里增加表单验证hibernate-validator并在freemarker模板里显示错误信息(推荐)
- 10深入解析java虚拟机




