0

I have an app on Nodejitsu with a MongoHQ database that is working. Now I wish to see and manage my DB from my terminal. Here is the code I write:

mongo troup.mongohq.com:10014/database -u <dbuser> -p <dbpassword>

The problem is I don't know whats my username and password. All I get from Nodejitsu is the MongoHQ username and Password but thats not correct.

Basically - How do I get my username and password for the DB - as stated in this question -

Unable to connect to MongoLab "auth fails" error

Currently I am getting -

Error: 18 { code: 18, ok: 0.0, errmsg: "auth fails" } at src/mongo/shell/db.js:228

Thank you very much

Community
  • 1
  • 1
orepor
  • 905
  • 2
  • 13
  • 23

2 Answers2

0

Click on Admin, then choose the Users tab, add a user by typing a username and password into the "db.addUser" box. Then use your newly created user account to connect.

JamesClevenger
  • 1,122
  • 6
  • 6
  • Hey - Thanks! When I do that I get this - Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" } – orepor Mar 08 '14 at 20:39
  • Did you ever figure out what that startup warnings message means? I'm getting it now. – Nikhil Apr 30 '14 at 21:54
0

By default I believe Mongo tries to connect to the admin database. You should ensure that the user has the correct permissions usually readWrite. If that user is responsible only for a specific database consider doing the following from the CLI:

 mongo troup.mongohq.com:10014/database -u <dbuser> -p <dbpassword>   --authenticationDatabase <databasename>

If however that user will be responsible for multiple databases. You should update the privileges for that user. More at the MongoDb docs Create the system user administrator and privileges

Skillachie
  • 3,176
  • 1
  • 25
  • 26