MongoLab授权异常

发布于 2024-11-29 17:56:01 字数 979 浏览 0 评论 0原文

我在 MongoLab 云服务器上创建了一个 MongoDB 帐户,并且创建了一个数据库,并且到目前为止它是空的(没有集合,只有 1 个用户)。

这就是 Mongolab 给出的连接到数据库的命令

mongo dbh13.mongolab.com:27137/myDB -u <username> -p <password>

是这里的用户名 mongolab 帐户凭据或我在 myDB 中创建的用户。我都试过了,没有授权。

但如果尝试在未经授权的情况下直接连接(来自 Windows),它会起作用 使用此命令

mongo dbh13.mongolab.com:27137/myDB

,但之后如果我尝试执行类似 show dbs/show collections 的操作,则会失败并显示以下消息

> show dbs
assert failed : listDatabases failed:{
        "assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
        "assertionCode" : 10057,
        "errmsg" : "db assertion failure",
        "ok" : 0
}
Fri Aug 12 16:30:50 uncaught exception: assert failed : listDatabases failed:{
        "assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
        "assertionCode" : 10057,
        "errmsg" : "db assertion failure",
        "ok" : 0
}

有什么想法吗?

I created a MongoDB account on MongoLab cloud server and I have a DB created and its empty (no collection, just 1 user) as of now.

this is what the command given at Mongolab to connect to the DB

mongo dbh13.mongolab.com:27137/myDB -u <username> -p <password>

is the user name here mongolab account credentials or the user i created in the myDB there.? I tried both, it's not authorizing.

but if try to connect to directly with out authorization (from Windows), it worked
with this command

mongo dbh13.mongolab.com:27137/myDB

but after which if i try to do something like show dbs/show collections it fails with the following message

> show dbs
assert failed : listDatabases failed:{
        "assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
        "assertionCode" : 10057,
        "errmsg" : "db assertion failure",
        "ok" : 0
}
Fri Aug 12 16:30:50 uncaught exception: assert failed : listDatabases failed:{
        "assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
        "assertionCode" : 10057,
        "errmsg" : "db assertion failure",
        "ok" : 0
}

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稳稳的幸福 2024-12-06 17:56:01

获得了授权解决方案

> mongo "dbh13.mongolab.com:27137/myDB"
  MongoDB shell version: 1.6.5
  connecting to: dbh13.mongolab.com:27137/myDB

> db.auth("<username>","<password>")

我从 Windows shell http://support.mongolab.com/entries/20177338-im-using-the-windows-mongo-shell-and-can-t-connect-help

I got the solution for authorization from windows shell

> mongo "dbh13.mongolab.com:27137/myDB"
  MongoDB shell version: 1.6.5
  connecting to: dbh13.mongolab.com:27137/myDB

> db.auth("<username>","<password>")

http://support.mongolab.com/entries/20177338-i-m-using-the-windows-mongo-shell-and-can-t-connect-help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文