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
Yanwenjingcn opened this issue Nov 9, 2020 · 4 comments
Closed

Comments

@Yanwenjingcn
Copy link

@Yanwenjingcn Yanwenjingcn commented Nov 9, 2020

image
image

本身db密码类似于

fsf@_gdajgnja*sdk^,

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

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

@horizonzy
Copy link
Collaborator

@horizonzy horizonzy commented Nov 9, 2020

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

Loading

@KomachiSion
Copy link
Collaborator

@KomachiSion KomachiSion commented Nov 9, 2020

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

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

Loading

@horizonzy
Copy link
Collaborator

@horizonzy horizonzy commented Nov 9, 2020

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

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

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

Loading

@KomachiSion
Copy link
Collaborator

@KomachiSion KomachiSion commented Nov 9, 2020

可以考虑

Loading

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
penghao03 added a commit to penghao03/nacos that referenced this issue Nov 14, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants