docker run -itd --privileged=true \
--restart=always  \
--name mongo  \
-p 27017:27017  \
-v /hytd/mongo/db:/data/db \
-v /hytd/mongo/configdb:/data/configdb \
mongo  \
--auth \
use admin
 
db.createUser(
  {
    user: "hytd",
    pwd: "hytd@2021",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
  }
)
posted on 2021-04-07 09:39  肖建锋  阅读(28)  评论(0编辑  收藏  举报