这个错误表明在尝试连接到 MongoDB 服务器时,身份验证失败了。错误代码 18 和错误消息 "AuthenticationFailed" 清楚地指出了这一点。 要解决这个问题,你可以按照以下步骤进行排查和修复: 检查用户名和密码: 确保你使用的用户名和密码是正确的。 如果不确定,可以尝试重置密码或联系数据库管理员获取正确的凭证。 确认认...
mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed"} ... ... 2. Solution 2.1. Use Admin...
db_uri = "mongodb://" + usr + ":" + pwd + "@" + \ url + "/test_db?authSource=admin&retryWrites=true&w=majority" 1. 2. 参考: https://stackoverflow.com/questions/72048051/pymongo-auth-failure-ok-0-0-errmsg-authentication-failed-code-18 https://www.5axxw.com/questions/content/...
spring.data.mongodb.password=secret server.port=8082 spring.data.mongodb.uri=mongodb://localhost:27017 spring.data.mongodb.database=interviewTest 我收到: com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'command find requires authentication' on server localhost:270...
进入mongo控制台 >mongo 查看数据库 show dbs 新建账户 > db.createUser({user:"root",pwd:"123456",roles:[{role:"userAdminAnyDatabase",db:"admin"}]}) 打印: Successfully added user: { "user":"root", "roles": [ { "role":"userAdminAnyDatabase", ...
’在服务器本地主机上:27017刚刚安装完mongo db 并且让这个mongo db安装成系统服务,然后给启动啦,以为自己这就可以像MySQL那样;安装好之后,配合可视化工具Navicat for MySQL简单的就跑起来了, 但是呢,并不是这个样子。出bug啦,我暂且记录一下,正在找解决之法。
db.createUser({user:'rgc',pwd:'dfdf',roles:[{role:'dbOwner',db:'test'}]}) # 给rgc用户设置密码,并且有 test 数据库的 dbOwner权限 【需要有添加用户的权限,可以先取消服务改为非认证机制】 然后进行如下操作,便可成功 mongoexport -d test -c rgc -o /mnt/g/rgc.json -u rgc -p dfdf --a...
通过NoSQLBooster工具成功链接建立的MongoDB数据库,但Python代码链接测试一直失败报错。失败详情如下: Traceback (most recent call last): File "E:\PycharmSpace\helloworld\MongoDBTest.py", line 21, in <module> for doc in data: File "D:\softwares\Anaconda3\lib\site-packages\pymongo\cursor.py", li...
Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18, codeName: "AuthenticationFailed" } 0 forced to new node become PRIMARY not work. mongodb mongodb-3.4 Share Improve this question Follow edited Jun 2, 2018 at 8:24 Paul White♦ 88.5k3030 gold badges418418 silver badges655655...
1 MONGODB_URI=mongodb://127.0.0.1:27017/mydb Note: If you are connecting to a MongoDB Atlas cluster, you can find your connection string in the Atlas dashboard. Create a lib/mongodb.ts file and add the following code for connecting to a MongoDB database using mongoose: 1 import mong...