如何将mongo base从本地文件夹还原到uri

问题描述 投票:0回答:1

我使用以下代码,但失败:连接到数据库服务器时出错:SASL身份验证步骤中服务器返回错误:身份验证失败。如何使用uri将数据库从本地文件夹还原到mondogb产品服务器?

mongorestore -h 10.10.10.10 --port 27017 -d test_base -u myusername -p mypassword C:\My profile\Documents\mongo\test_base
database mongodb database-backups database-restore
1个回答
0
投票

mongo工具有两个数据库选项:

  • --db=<database>, -d=<database>

    指定从mongorestore从BSON文件还原时将数据还原到的目标数据库。

  • --authenticationDatabase=<dbname>

    指定用于向使用身份验证的MongoDB数据库进行身份验证的密码。

身份验证数据库通常为admin,但是默认情况下为目标数据库(如果提供)。关于此主题的mongo文档尚不十分清楚。

然后检查语法。可以提供选项,例如

  • /u myusername
  • -u myusername
  • -u=myusername
  • /username:myusername
  • --username:myusername
  • --username=myusername

不幸的是,不清楚哪个有效(或哪个有效)。当您在Linux和Windows上运行mongorestore --help并查看documentation时,会发现它不一致。

执行“尝试和错误”

© www.soinside.com 2019 - 2024. All rights reserved.