MongoDB创建用户

2016-06-13  本文已影响45人  wxy325

use products

db.createUser( { "user" : "accountAdmin01",
"pwd": "cleartext password",
"customData" : { employeeId: 12345 },
"roles" : [ { role: "clusterAdmin", db: "admin" },
{ role: "readAnyDatabase", db: "admin" },
"readWrite"
] },
{ w: "majority" , wtimeout: 5000 } )

///////// Success

db.auth('accountAdmin01', 'cleartext password');

上一篇下一篇

猜你喜欢

热点阅读