show dbs failing on mongo console

Views: 304 Ask New Question

> show dbs
2019-05-04T14:38:46.880+0000 E QUERY    [thread1] Error: listDatabases failed:{
    "ok" : 0,
    "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
    "code" : 13,
    "codeName" : "Unauthorized"
On By

1 Answer

This looks like you need to authenticate first before listing dbs.

If you know the admin db password you can do the following

use admin 
db.auth("admin", "<password>");
show dbs
On By

Answer This Question