美文网首页
MongoDB创建用户

MongoDB创建用户

作者: wxy325 | 来源:发表于2016-06-13 00:57 被阅读45次
    
    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');
    
    

    相关文章

      网友评论

          本文标题:MongoDB创建用户

          本文链接:https://www.haomeiwen.com/subject/lucydttx.html