2

我正在使用 Ubuntu16.04,并且我在 mongodb 中启用了授权并通过以下方式创建了用户。

use admin
db.createUser(
  {
    user: "ABC",
    pwd: "XYZ",
    roles: [ { role: "root", db: "admin" } ]
  }
);

并且在通过终端连接到 mongodb 时重新启动 mongodb 服务器授权工作正常。

sudo service mongod restart
mongo -u ABC -p --authenticationDatabase admin

但是当我尝试使用 Studio3T 连接到我的本地主机 mongodb 数据库时,如下

Authentication Mode : "Basic (MONGODB-CR or SCRAM-SHA-1)"
username : (ABC)
password : (XYX)
Authentication DB: (admin)   

我收到如下错误消息。

Connection failed.

SERVER [localhost:27017] (Type: UNKNOWN) 
|_/ Connection error (MongoSocketWriteException): Exception sending message
|____/ Socket error: Connection reset

Details:
Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {java.net.SocketException: Connection reset}}]
4

0 回答 0