mongodb安装命令

mongod --install --logpath="E:\MongoDB\data\log\MongoDB.log" --dbpath="E:\MongoDB\data\db" 
mongod  --remove --serviceName "MongoDB"

mongod --dbpath="E:\MongoDB\data\db" --logpath="E:\MongoDB\data\log\MongoDB.log" -auth -service


mongod --dbpath="E:\MongoDB\data\db" --logpath="E:\MongoDB\data\log\MongoDB.log" -auth -service
mongod --logpath "D:\MongoDB\data\log\MongoDB.log" --logappend --dbpath "D:\MongoDB\data\db" --directoryperdb --serviceName "MongoDB" --
serviceDisplayName "MongoDB" --install



use admin
db.createUser(
  {
    user: "admin",
    pwd: "password",
    roles:
    [
      {
        role: "userAdminAnyDatabase",
        db: "admin"
      }
    ]
  }
)
db.auth('root','root')

 

posted @ 2017-01-24 14:20  释迦苦僧  阅读(178)  评论(0编辑  收藏  举报