MongoDBassertion:18{code:18,ok:0.0,errmsg:"authfails"}-成都快上网建站

MongoDBassertion:18{code:18,ok:0.0,errmsg:"authfails"}

assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }

我们提供的服务有:成都网站制作、网站设计、外贸网站建设、微信公众号开发、网站优化、网站认证、沁阳ssl等。为上1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的沁阳网站制作公司

MongoDB 2.4.10 使用admin数据库下的xucy管理员帐号导出数据,验证失败。

# mongoexport -uxucy -p -d Test -c Pro -f _id,SK2,SK3 -o /data/var/log/mongodb/pro.json   
connected to: 127.0.0.1    
Enter password:     
assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }

解决方法:

这个是2.2.2版本以后出现的,参考:https://jira.mongodb.org/browse/SERVER-9991

需要加入验证参数:  

--authenticationDatabase admin

类似的命令有mongodump、mongorestore、mongoexport、mongoimport

# mongoexport --authenticationDatabase admin -uxucy -p -d Test -c Pro -f _id,SK2,SK3 -o /data/var/log/mongodb/pro.json   
connected to: 127.0.0.1    
Enter password:     
exported 564097 records

本文名称:MongoDBassertion:18{code:18,ok:0.0,errmsg:"authfails"}
标题网址:http://kswjz.com/article/ieeied.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流