微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Windows中的MongoDB身份验证

如何解决Windows中的MongoDB身份验证

我已经在本地主机中使用mongoDB已有一段时间了。从一开始,我就没有对自己进行身份验证,即。我没有用户名和密码。我直接在控制台中进行工作。

现在,我正试图进行强化治疗,但我遇到了一些问题:

首先,我这样做:

use Admin

db.createuser(
  {
    user: "superuser",pwd: "changeMetoAStrongPassword",roles: [ "root" ]
  }
)

这没有显示错误,也做了show users并得到了我需要的结果

然后按照MongoDB官方网站上的说明,在命令提示符下执行此操作:

"C:\Program Files\MongoDB\Server\4.4\bin\mongod.exe" --dbpath "d:\test\mongo db data" --auth

我明白了:

{"t":{"$date":"2020-09-22T09:45:31.719+05:30"},"s":"I","c":"CONTROL","id":23285,"ctx":"main","msg":"Automatically disabling TLS 1.0,to force-enable TLS 1.0 specify --ssldisabledProtocols 'none'"}
{"t":{"$date":"2020-09-22T09:45:31.729+05:30"},"s":"W","c":"ASIO","id":22601,"msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-09-22T09:45:31.731+05:30"},"c":"NETWORK","id":4648602,"msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2020-09-22T09:45:31.747+05:30"},"c":"STORAGE","id":4615611,"ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":6616,"port":27017,"dbPath":"d:/test/mongo db data","architecture":"64-bit","host":"LAPTOP-FRA3EPR8"}}
{"t":{"$date":"2020-09-22T09:45:31.748+05:30"},"id":23398,"msg":"Target operating system minimum version","attr":{"targetMinOS":"Windows 7/Windows Server 2008 R2"}}
{"t":{"$date":"2020-09-22T09:45:31.756+05:30"},"id":23403,"msg":"Build Info","attr":{"buildInfo":{"version":"4.4.1","gitVersion":"ad91a93a5a31e175f5cbf8c69561e788bbc55ce1","modules":[],"allocator":"tcmalloc","environment":{"distmod":"windows","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-09-22T09:45:31.762+05:30"},"id":51765,"msg":"Operating System","attr":{"os":{"name":"Microsoft Windows 10","version":"10.0 (build 18362)"}}}
{"t":{"$date":"2020-09-22T09:45:31.774+05:30"},"id":21951,"msg":"Options set by command line","attr":{"options":{"security":{"authorization":"enabled"},"storage":{"dbPath":"d:\\test\\mongo db data"}}}}
{"t":{"$date":"2020-09-22T09:45:31.798+05:30"},"s":"E","id":20557,"msg":"DBException in initAndListen,terminating","attr":{"error":"NonExistentPath: Data directory d:\\test\\mongo db data not found. Create the missing directory or specify another path using (1) the --dbpath command line option,or (2) by adding the 'storage.dbPath' option in the configuration file."}}
{"t":{"$date":"2020-09-22T09:45:31.799+05:30"},"c":"REPL","id":4784900,"msg":"Stepping down the ReplicationCoordinator for shutdown","attr":{"waitTimeMillis":10000}}
{"t":{"$date":"2020-09-22T09:45:31.806+05:30"},"c":"COMMAND","id":4784901,"msg":"Shutting down the MirrorMaestro"}
{"t":{"$date":"2020-09-22T09:45:31.812+05:30"},"c":"SHARDING","id":4784902,"msg":"Shutting down the WaitForMajorityService"}
{"t":{"$date":"2020-09-22T09:45:31.824+05:30"},"id":20562,"msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2020-09-22T09:45:31.829+05:30"},"id":4784905,"msg":"Shutting down the global connection pool"}
{"t":{"$date":"2020-09-22T09:45:31.839+05:30"},"id":4784906,"msg":"Shutting down the FlowControlTicketholder"}
{"t":{"$date":"2020-09-22T09:45:31.847+05:30"},"c":"-","id":20520,"msg":"Stopping further Flow Control ticket acquisitions."}
{"t":{"$date":"2020-09-22T09:45:31.858+05:30"},"id":4784918,"msg":"Shutting down the replicasetMonitor"}
{"t":{"$date":"2020-09-22T09:45:31.873+05:30"},"id":4784921,"msg":"Shutting down the MigrationUtilExecutor"}
{"t":{"$date":"2020-09-22T09:45:31.880+05:30"},"id":4784925,"msg":"Shutting down free monitoring"}
{"t":{"$date":"2020-09-22T09:45:31.891+05:30"},"c":"FTDC","id":4784926,"msg":"Shutting down full-time data capture"}
{"t":{"$date":"2020-09-22T09:45:31.896+05:30"},"id":4784927,"msg":"Shutting down the HealthLog"}
{"t":{"$date":"2020-09-22T09:45:31.906+05:30"},"id":4784929,"msg":"Acquiring the global lock for shutdown"}
{"t":{"$date":"2020-09-22T09:45:31.912+05:30"},"id":4784931,"msg":"Dropping the scope cache for shutdown"}
{"t":{"$date":"2020-09-22T09:45:31.923+05:30"},"id":20565,"msg":"Now exiting"}
{"t":{"$date":"2020-09-22T09:45:31.929+05:30"},"id":23138,"msg":"Shutting down","attr":{"exitCode":100}}

我什至尝试创建目录,但似乎不起作用。 请帮忙

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?