我使用的是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连接到我的localhost 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}}]