标签:mongodb mongoexport auth fails
assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }
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
本文出自 “SQL Server Deep Dives” 博客,请务必保留此出处http://ultrasql.blog.51cto.com/9591438/1658881
MongoDB assertion: 18 { code: 18, ok: 0.0, errmsg: "auth fails" }
标签:mongodb mongoexport auth fails
原文地址:http://ultrasql.blog.51cto.com/9591438/1658881