Reputation: 2210
I have two servers, one for app(rails) and one for db(mongo).My rails config for mongo will be like this(yaml file):
hosts:
- xxx.xxx.xxx.xxx:57777
database: admin
username: root
password: some_password
So.. how can I configure on the mongo server including the 57777
port, password for root user?
Update
I tried to change the password but in vain:
$ mongo
> use admin
> db.changeUserPassword("root", "new_password")
Error: Updating user failed: User root@admin not found at src/mongo/shell/db.js:1105
Upvotes: 0
Views: 709
Reputation: 1935
First you will need to create a user with the following command on mongo shell:
use admin
db.createUser(
{
user: "root",
pwd: "some_password",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" }
]
}
)
You can then stop mongo server(kill). Now start mongo server with the command : mongod --port 57777 -u root -p some_password --authenticationDatabase admin
Upvotes: 1