1. 程式人生 > >mongodb 設置權限

mongodb 設置權限

max tle readwrite radi pre mark ack display adding

切換到要加密的數據庫
use diary

創建有 readWrite 權限的用戶
db.createUser({ user: "youruser", pwd: "yourpassword", roles: [{ role: "readWrite", db: "diary" }] })

啟用權限驗證
./mongod --auth

命令行連接
./mongo -u "youruser" -p "yourpassword" --authenticationDatabase diary

url連接
mongodb://youruser:yourpassword@localhost:27017/diary

?

mongodb 設置權限