# mongorestore -u yourdb dump/ Enter password: 2017-06-09T11:55:58.566+0800 Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.
# mongorestore -u yourdb -d yourdb dump/yourdb
> use admin switched to db admin > db.addUser('neo','chen') { "user" : "neo", "readOnly" : false, "pwd" : "68ace374737253d87e0ec91d4fcb673d" } > db.system.users.find() { "_id" : ObjectId("4c481404b9db6474d2fcb76f"), "user" : "neo", "readOnly" : false, "pwd" : "68ace374737253d87e0ec91d4fcb673d" } > db.auth('neo','chen') 1
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。