- 创建用户
db.createUser({"user":"content", "pwd":"conTentR6G", roles:[{"role":"readWrite","db":"content"}, { "role" : "dbAdmin", "db" : "content" }]});
- 链接库
mongo localhost:27017/dbname -u "wu" -p "jp123"
- 导出mongodb库数据
mongodump -h localhost:27017 -d dbname -o output.txt -u=user -p="password"
- 导入库
mongorestore -h localhost:27017 -d dbname output.txt -u=user -p=password --authenticationDatabase admin