gpt4 book ai didi

node.js - 蒙戈错误: authentication failed (code 18) when connecting to mLab from node app

转载 作者:太空宇宙 更新时间:2023-11-03 22:28:55 25 4
gpt4 key购买 nike

当我尝试从 Node 应用程序连接到 mLab 数据库时,出现“身份验证失败”错误(代码 18)。 我使用的凭据是正确的;这一点我已经验证过很多次了。我什至创建了一个新的数据库用户,但这并没有改变任何东西。

const mongoClient = require('mongodb').MongoClient;

mongoClient.connect('mongodb://<username>:<password>@ds159387.mlab.com:59387/day-planner', (err, database) => {
console.log(err);
});

最佳答案

我在通过 MongoDB URI 连接时遇到了同样的问题,并联系了他们。问题是我在密码中包含了一个特殊字符 (@),解析器将其视为分隔符,正如您在 URI 中看到的那样,因此密码解析错误。他们建议不要在密码中包含任何特殊字符,结果成功了。

关于node.js - 蒙戈错误: authentication failed (code 18) when connecting to mLab from node app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40782158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com