mongorestore[报错]auth error: sasl c onversation error: unable to authenticate using mechanism

简介: mongodb中添加了admin表的用户,即创建了超级管理员(mongodb的安全生产环境的权限设置请查看:[https://blog.csdn.net/Chenftli/article/details/105228130](https://blog.csdn.net/Chenftli/article/details/105228130)),此时我想去将备份的集合的bson文件数据导入到mongodb指定的数据库时会报出上面的错误。##### 尝试尝试使用下面的命令执行
完整报错:
2020-06-09T17:42:44.532+0800 error connecting to host: could not connect to server: connection() : auth error: sasl c
onversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
来由:

mongodb中添加了admin表的用户,即创建了超级管理员(mongodb的安全生产环境的权限设置请查看:
https://blog.csdn.net/Chenftli/article/details/105228130),此时我想去将备份的集合的bson文件数据导入到mongodb指定的数据库时会报出上面的错误。

尝试

尝试使用下面的命令执行

.\mongorestore.exe --host 127.0.0.1 --port 27017 --username 用户名  --password 密码 -d 恢复集合的数据库名 "D:\periodical1.bson"

D:\periodical1.bson为bson数据的路径,执行过后还是报上面的错误

解决:

最后加上下面参数才终于解决问题

--authenticationDatabase admin -u 用户名 -p 密码

实例:

./mongorestore.exe --host 127.0.0.1 --port 27017 --authenticationDatabase admin -u username -p password -d tests "D:\periodical1.bson"

username为用户名,password为密码 ,tests为恢复集合的数据库名

目录
相关文章
|
4月前
|
数据安全/隐私保护
INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostT
这篇文章描述了作者在执行HDFS操作时遇到的SASL加密信任检查日志信息问题,其中`localHostTrusted`为`false`,并且有时候这个日志信息会出现,有时候不会。
INFO sasl.SaslDataTransferClient: SASL encryption trust check: localHostTrusted = false, remoteHostT
完美解决 fatal: unable to access ‘https://github.com/Homebrew/brew/‘
完美解决 fatal: unable to access ‘https://github.com/Homebrew/brew/‘
1420 0
|
6月前
|
Unix 数据安全/隐私保护
|
4月前
|
Web App开发 Java 网络安全
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
589 0
|
7月前
|
Unix 网络安全 数据安全/隐私保护
putty Faual Error:No supported authentication methods available (server sent: publickey)
putty Faual Error:No supported authentication methods available (server sent: publickey)
1383 0
|
7月前
An unexpected error was encountered while executing a WSL command. Common causes include access righ
An unexpected error was encountered while executing a WSL command. Common causes include access righ
|
7月前
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
【Error】fatal: unable to access ‘https://github.com/PanJiaChen/vue-element-admin/‘: OpenSSL SSL_read:
|
开发工具 数据安全/隐私保护 git
Authentication failed for 错误
Authentication failed for 错误
240 0
|
Shell 网络安全 开发工具
fatal: unable to access github.com schannel failed to receive handshake, SSL/TLS connection failed
fatal: unable to access github.com schannel failed to receive handshake, SSL/TLS connection failed
290 0
|
Java
Error: A JNI error has occurred, please check your installation and try again
Error: A JNI error has occurred, please check your installation and try again
199 0