切换到要加密的数据库
use diary

创建有 readWrite 权限的用户
db.createUser({ user: "youuser", pwd: "youpassword", roles: [{ role: "readWrite", db: "diary" }] })

启用权限验证
./mongod --auth

命令行连接
./mongo -u "youuser" -p "youpassword" --authenticationDatabase diary

url连接
mongodb://youuser:youpassword@localhost:27017/diary

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
猜你喜欢
  • 2021-04-21
  • 2022-01-01
  • 2022-12-23
  • 2021-07-12
  • 2021-07-08
  • 2022-12-23
相关资源
相似解决方案