mongo单表导入导出命令及报错问题 报错如图
error connecting to db server: no reachable servers
##导入测试成功
./mongoimport -hxxx:27017 -uroot -pxxx --authenticationDatabase admin -ddbname -c collectionname --file xxx/file.json
##导出测试成功
./mongoexport -hxxx:27017 -uroot -p123456 --authenticationDatabase admin -ddbname -ccollectionname -o 导出文件名 --type json
--authenticationDatabase admin 如果需要鉴权库对应加我这边是admin鉴权
-d :目标数据库名
-c :目标collection名
-o :输出的文件名
--type : 输出的格式,默认为json
原创不易,一同进步