Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当数据库密码里面有特殊字符【逗号】时db密码不生效 #4179

Closed
wengieeee opened this issue Nov 9, 2020 · 5 comments
Closed
Labels
kind/user experience not necessarily an error but can be improved for user experience

Comments

@wengieeee
Copy link

image
image

本身db密码类似于

fsf@_gdajgnja*sdk^,

注意,我们有逗号,有逗号,有逗号

但是一直报access denied,密码错误,但是直接mysql -h XXX -u nacos -p XXXX 是可以登上。

@horizonzy
Copy link
Collaborator

当密码存在,时,设置db.passsword时如果没有指定.0的话,会通过,将密码进行分割,最后用下标为0的那个密码。你这种情况最终使用的密码其实是fsf@_gdajgnja*sdk^。注意是没有逗号的。
如果密码中存在逗号的情况,指定db.password.0来直接对密码进行设置。不对密码做逗号的切割。

@KomachiSion
Copy link
Collaborator

KomachiSion commented Nov 9, 2020

解释一下,nacos考虑到配置主备数据源的情况,db 的 url,username,password是一个列表, spring对于list列表的配置会取.n的下标或者按照分隔符分割(默认,) 因此当内容中有该分隔符的时候,可能会出问题。

建议按照xx.0=abc的方式配置

@KomachiSion KomachiSion added the status/invalid This doesn't seem right label Nov 9, 2020
@horizonzy
Copy link
Collaborator

解释一下,nacos考虑到配置主备数据源的情况,db 的 url,username,password是一个列表, spring对于list列表的配置会取.n的下标或者按照分隔符分割(默认,) 因此当内容中有该分隔符的时候,可能会出问题。

建议按照xx.0=abc的方式配置

要不要把默认的注释那里改成.0的,感觉这样对用户来说好一点。

@KomachiSion
Copy link
Collaborator

可以考虑

@KomachiSion KomachiSion added kind/user experience not necessarily an error but can be improved for user experience and removed status/invalid This doesn't seem right labels Nov 10, 2020
KomachiSion pushed a commit that referenced this issue Nov 10, 2020
* add index for db.user and db.password, to avoid some situation that it contains symbol ','

* add multi data source template

* add line to separate

* Revert "add line to separate"

This reverts commit 390eb6f

* Revert "add multi data source template"

This reverts commit 4470e63
@bcdslg
Copy link

bcdslg commented Jun 15, 2022

这种情况docker-compose 中怎么配置密码呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/user experience not necessarily an error but can be improved for user experience
Projects
None yet
Development

No branches or pull requests

4 participants