MongoDB: Server has startup warnings

Run mongod --auth to enable access control. Detailed information can be found here.


You haven't configure the security features in Mongodb like authorization and authentication. Use this link for more details. You can ignore this if you are going to learn Mongodb. But when the product is going to production level. you should concern them. You can enable access control by using mongod --auth.

For example you can run mongod --auth --port 27017 --dbpath /data/db1. After that you can secure your database with username and password.

you can add user in database using following command.

use admin
db.auth("myUserAdmin", "abc123" )

After that you can use mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin" to connect to the database.

You can add bind_ip in mongod.conf as follows,

`bind_ip = 127.0.0.1,192.168.161.100` 

You can define many if you need. This bind_ip option tells MongoDB to accept connections from which local network interfaces, not which “remote IP address”. And run mongod --config <file path to your mongod.conf> Altogether you can run mongod --auth --port 27017 --dbpath /data/db1 --config <file path to your mongod.conf>