mongodb 增加用户以及认证用户

test>use admin
switched to db admin
admin>db.addUser('yshy','yshy')
{
        "user" : "yshy",
        "readOnly" : false,
        "pwd" : "2059c25b25df531ec5652d3eba0dc175",
        "_id" : ObjectId("5556a6da70d9c8c0f6a120ab")
}
admin>db.auth('yshy','yshy')
1
admin>db.system.users.find()
{ "_id" : ObjectId("545ab87bdc558a6592571d5b"), "user" : "yanshiying", "readOnly" : false, "pwd" : "044f63528e7807275411c4731052fe36" }
{ "_id" : ObjectId("5556a6da70d9c8c0f6a120ab"), "user" : "yshy", "readOnly" : false, "pwd" : "2059c25b25df531ec5652d3eba0dc175" }
admin>

 

posted @ 2015-05-16 10:23  yshy  阅读(201)  评论(0编辑  收藏  举报