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为恢复集合的数据库名

目录
相关文章
|
9月前
完美解决 fatal: unable to access ‘https://github.com/Homebrew/brew/‘
完美解决 fatal: unable to access ‘https://github.com/Homebrew/brew/‘
424 0
|
5天前
|
Unix 网络安全 数据安全/隐私保护
putty Faual Error:No supported authentication methods available (server sent: publickey)
putty Faual Error:No supported authentication methods available (server sent: publickey)
238 0
|
5天前
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
|
5天前
【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:
|
6月前
Error from server error dialing backend remote error tls internal error
Error from server error dialing backend remote error tls internal error
45 0
|
6月前
|
开发工具 数据安全/隐私保护 git
Authentication failed for 错误
Authentication failed for 错误
|
11月前
|
Java Maven 数据安全/隐私保护
Could not transfer artifact from/to Authentication failed for 401 Unauthorized
Could not transfer artifact from/to Authentication failed for 401 Unauthorized
339 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
236 0
configure: error: You requested LIBYUV but not found...die
configure: error: You requested LIBYUV but not found...die
67 0
|
开发者 Python
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied
346 0
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied