Skip to content

Instantly share code, notes, and snippets.

@deepal
Created May 19, 2016 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deepal/033b021e12aa90f91bc709f7ac2bf22d to your computer and use it in GitHub Desktop.
Save deepal/033b021e12aa90f91bc709f7ac2bf22d to your computer and use it in GitHub Desktop.
$ mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "mydatabase"
MongoDB shell version: 3.0.12
connecting to: 127.0.0.1:27017/test
> use mydatabase
switched to db mydatabase
> db.auth('myUserAdmin','abc123');
1
> db.auth('myUserAdmin','wrong-password');
Error: 18 Authentication failed.
0
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment