Mongodb对本地数据库进行身份验证

时间:2016-04-28 16:27:56

标签: node.js mongodb authentication database nosql

我正在尝试从节点应用程序连接到mongodb的本地实例。但我似乎无法进行身份验证,它一直试图通过本地数据库而不是管理数据库来验证我。

在我的配置文件中这里是我的

// mongodb config
config.mongodb.name = 'my_db_name';
config.mongodb.local.collection = 'my_db_name';
config.mongodb.username = 'user';
config.mongodb.password = 'pass';
config.mongodb.adminPrompt = false;

这是我在节点终端中运行应用程序时遇到的错误

数据库身份验证失败:db = local username = user workerPid = 9921

在mongo终端我收到此错误

2016-04-28T12:21:30.931-0400 I ACCESS   [conn3] Successfully authenticated 
as principal vpoc on my_db_name

2016-04-28T12:21:30.500-0400 I ACCESS   [conn10] SCRAM-SHA-1 authentication failed for 
user on local from client 127.0.0.1 ; UserNotFound Could not find user user@local

我做错了什么?

0 个答案:

没有答案