安装
https://blog.csdn.net/qq_43626378/article/details/108430713
启动服务
systemctl start mongod.service
添加数据库管理员
https://blog.csdn.net/hecr_mingong/article/details/109724758
1.关闭服务
systemctl stop mongod.service
1
2
3
4
5
6
7
8
9
10mongo
# 创建超级用户
use admin
db.createUser({user:"admin",pwd:"password",roles:["root"]})
db.auth('admin','password')
# 切换至需要做登录的集合
use your_database
db.createUser({user:'user',pwd:'password',roles:['dbOwner']})