March 5th, 2013
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: firstname.lastname@example.org
This is surprisingly confusing. It is strange to start MongoDb and be able to access it without needing a username or password.
I got it now. Here is what I document:
1) In mongo command line: (let say, set administrator)
> use admin;
2) Shutdown Server and exit
3) Restart Mongod with –auth
$ sudo ./mongodb/bin/mongod –auth –dbpath /mnt/db/
4) Run mongo again in 2 ways:
i) run mongo first then login.
$ ./mongodb/bin/mongo localhost:27107
> use admin
ii) run & login to mongo in command line.
$ ./mongodb/bin/mongo localhost:27107/admin -u admin-p 123456
* The username & password will work the same for mongodump and mongoexport.