System: centos7
mongo client: mongo2.6.12
mongo server: mongo3.6
Connection error:
2018-07-02T11:51:48.904+0800 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18, codeName: "AuthenticationFailed" } at src/mongo/shell/db.js:1292
exception: login failed
Reason: Due to the low version of Mongo Client, the authentication mechanism is not supported, resulting in client authentication failure.
Solutions:
sudo yum remove mongodb
sudo yum remove mongodb-server
Install Mongodb3.6 version
Refer to CentOS 7 to install MongoDB 3.6
After successful installation, according to the authentication mechanism set by the server, select scRAM-SHA-1 or MongoDB-CR, and default to SCRAM-SHA-1
Connection command:
mongo -authenticationDatabase admin -u user -p pass -host hostname -port 27017 [--authenticationMechanism SCRAM-SHA-1]
div>
Read More:
- Error in Python connection to mongodb pymongo.errors.OperationFailure : Authentication failed.
- [Solved] MongoDB Insert Data Error: OperationFailure: Authentication failed…
- Mongodb uses Mongo to report error: could’t connect to server 127.0.0.1:27017, connection attempt failed: socket
- 【MongoDB】 Failed to connect to 127.0.0.1:27017, reason: Connection refused
- MongoDB Error: Failed to start mongod.service: Unit mongodb.service is masked
- Error:Connection activation Failed: no suitable device found for this connection solution
- 【Linux】psql: FATAL: Ident authentication failed for user “username” Error and Solution
- An authentication error occurred in the remote desktop connection
- Mongodb failed to start: child process failed, exited with error number 100
- The mongoDB service failed to start (exception: connect failed)
- Node connects to MySQL error “Er”_ NOT_ SUPPORTED_ AUTH_ Mode “solution
- Authentication error occurred on remote connection, the required function is not supported
- Window installation of MongoDB exception: connect failed exception
- CDH HDFS webui browser authentication (after Kerberos authentication is enabled)
- django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
- MongoDB:Failed: error connecting to db server: no reachable servers
- Chrome your connection is not a private connection solution
- Ubuntu18 “Activation of network connection failed” cannot access the Internet 【Solution】
- Git authentication failure solution, due to the problem of password modification
- Nginx reports 502 error, log connect() failed (111: Connection refused) while connecting to upstream. A personal effective solution