- Create Admin
db.createUser({
user: 'admin',
pwd: '123456',
roles:[
{
role: 'root',
db: 'admin'
}
]
})
- Enable authorization
modify MongoDB fonfig file
…
…
security:
authorization: enable
…
…
- Restart MongoDB services