I create a user with the following set of commands. This should create user in both admin db as well as my target db (c2d):
admin
# mongo 127
try --authenticationDatabase=admin option in your terminal mongo command, if admin is the authentication database.
--authenticationDatabase=admin
For example:
insteed of: mongo 127.0.0.1:27017/c2d -u c2d -p c2d
mongo 127.0.0.1:27017/c2d -u c2d -p c2d
use: mongo 127.0.0.1:27017/c2d -u c2d -p c2d --authenticationDatabase=admin
mongo 127.0.0.1:27017/c2d -u c2d -p c2d --authenticationDatabase=admin