0

When i connect using from the OS shell,

mongo --port 27017 -u "testusr" -p "testpwd"  --authenticationDatabase "testdb"

Instead of switching taking me to testdb, it always logs me into test database? What I am missing here?

db.auth("testusr","testpwd") is working wihtout any authentication issues? How do I redirect to the correct database?

1 Answer 1

1

The following works for me

mongo localhost:27017/testdb -u "user" -p "pass"  --authenticationDatabase "testdb"

You can find help(i used in linux)

mongo --help
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo                   foo database on local machine
192.169.0.5/foo       foo database on 192.168.0.5 machine
192.169.0.5:9999/foo  foo database on 192.168.0.5 machine on port 9999
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.