1

My aim is to be able to connect myself from my local machine to a remote mongodb (version 3.2.8) instance with the following cmd:

mongo XX.XX.XXX.XXX:27017/myDB -u toto -p myPwd

i am getting this error

Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210
exception: login failed

I checked the mongoDB documentation and i understood that i have to install the same version locally

So I updated my local mongodb with brew like it is explained here Install MongoDB Community Edition on OS X and everything ran fine

toto$ brew install mongodb
toto$ Warning: mongodb-3.2.8 already installed

but when i try that:

toto$ mongod -version
db version v2.6.6

toto$ mongo -version
MongoDB shell version: 2.6.6

it seems that i am still using the old version locally.

I also tried to install it manually like it is explained in the documentation but nothing.

So I tried to set the path for mongo in my ~/.bashrc to use the version installed with brew like that:

toto$ cat ~/.bashrc

...    
# Setting PATH for MongoDb 3.2.8
    export MONGO_PATH=/usr/local/Cellar/mongodb/3.2.8
    export PATH=$PATH:$MONGO_PATH/bin
...

but nothing.

What am I missing or misunderstanding ...?

adam
  • 555
  • 1
  • 5
  • 17
  • I think you should first update your Homebrew then try to update mongodb. Not sure if this answers ur question.. Checkout [StackOverflow](http://stackoverflow.com/a/25359001/3050426) – pravin Mar 16 '17 at 08:05

1 Answers1

2

I finally uninstall mongodb:

brew uninstall mongodb

I also did that just in case: remove mongodb that was installed via brew Raw

that helped me to found out the old mongoDB version (really used) so i removed everything from my local (binaries, the export in ~/.bashrc).

I restarted the machine, re install mongodb with brew and now everything is working properly.

Don't know why i didn't try that from the begining !

I hope it will help someone.

if it is the case don't forget to up vote please :)

adam
  • 555
  • 1
  • 5
  • 17