如何解决MongoDB用户密码中特殊字符导致无法正常连接的问题

数据库NoSQL数据库技术服务知识库
问题描述

创建MongoDB实例后,复制实例中的连接地址信息,使用 mongo 原生客户端连接数据时报错。 图片 具体报错信息如下:

FailedToParse: Password must be URL Encoded for mongodb:// URL: mongodb://连接地址信息
```
`
# 解决方案
因为MongoDB对用户名或者密码中包含以下特殊字符,需要做 URL 编码。
将密码中的字符串url编码后重新连接:
````undefined
If the username or password includes the following characters:
: / ? # [ ] @
```
`
# 参考文档
[1] [https://docs.mongodb.com/manual/reference/connection-string/#examples](https://docs.mongodb.com/manual/reference/connection-string/#examples)
[2][https://www.url-encode-decode.com/](https://www.url-encode-decode.com/)
**如果您有其他问题,欢迎您联系火山引擎**[技术支持服务](https://console.volcengine.com/ticket/createTicketV2/)

40
0
0
0
相关产品
评论
未登录
看完啦,登录分享一下感受吧~
暂无评论