I have set up two servers s1 and s2. s1 is the server that a web server is running on while s2 is the server that my mongodb is running on. I have set up authentication on the mongo instance for security. When I try to connect to the mongo instance on s2 from s1 i get errors when trying to authenticate.
If I use:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB --authenticationMechanism SCRAM-SHA-1
I get this error:
Error: 2 SASL authentication support not compiled into client library.
at src/mongo/shell/db.js:228
exception: login failed
If I use:
mongo DB --host HOST --port PORT -u USER -p PASSWORD
--authenticationDatabase DB
I get this error:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 } at
src/mongo/shell/db.js:228
exception: login failed
If I use:
mongo DB --host HOST --port PORT
I get in but then I need to use db.auth in order to do anything and then I get this error:
Error: 18 { ok: 0.0, errmsg: "Challenge-response authentication using
getnonce and authenticate commands is disabled.", code: 2 }
I have no idea why I can't get in. Can someone help with this?
The problem is to do with wrong version of mongo client. check the version using the command
mongo --version
I have had problems while logging into mogodb on https://mlab.com/
The following fixed my problem and I am on Ubuntu xenial
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install mongodb-org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With