蒙戈版本:3.2.11
我使用 DigitalOcean 启动了一个 mongoDB Droplet,这样我就可以将一个数据库连接到我的小游戏。然而,并发症接踵而至。我正在通过 PuTTY 连接到 Droplet,并且之前能够调用“mongo”,然后键入“show dbs”以查看所有当前数据库。
我一直在更改 /etc/mongod.conf 文件以允许远程连接,从那时起 - 我调用的任何命令都会返回一条错误消息:
只是通过一个简单的 show dbs - 我明白了。
> show dbs
2016-12-28T00:12:26.655+0000 E QUERY [thread1] Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:761:19
shellHelper@src/mongo/shell/utils.js:651:15
@(shellhelp2):1:1
Run Code Online (Sandbox Code Playgroud)
我很困惑为什么会这样,我一直在网上搜寻任何可能解决这个问题的东西。
PS:我通过取消注释 security 并添加 authorization: 'enabled' 以及注释掉 net 下的 bindIp: 127.0.0.1 来更改 /etc/mongod.conf 文件。
mongodb ×1