【发布时间】:2019-08-27 09:37:06
【问题描述】:
我在我的 Mac 上使用自制软件安装了 MongoDB。
我在本地 mongodb 上创建了管理员帐户。
然后,我将以下代码添加到我的“mongod.conf”中以使用身份验证模式。
代码是“安全:授权:启用”。
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
security:
authorization: enabled
然后我重新启动了 MongoDB。 '酿造服务重启 mongodb'
但是每当我启动 mongo shell 时,它仍然会打印
WARNING: Access control is not enabled for the database.
Read and write access to data and configuration is unrestricted.
自然无需用户连接即可使用。
我该如何解决这个问题?
如果我输入
db.auth("username", "password")
它打印“1”。
如果我使用自制软件,是否无法对 mongoDB 进行身份验证?
我不知道我要做什么了。
请帮帮我。
谢谢。
+ 这是完整的日志
MongoDB shell version v4.0.3
connecting to: mongodb://127.0.0.1:27017
Implicit session: session { "id" : UUID("573560e4-0a3a-472e-a94a-79b1cecab4fd") }
MongoDB server version: 4.0.3
Server has startup warnings:
2019-08-27T19:02:40.847+0900 I CONTROL [initandlisten]
2019-08-27T19:02:40.847+0900 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-08-27T19:02:40.847+0900 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-08-27T19:02:40.847+0900 I CONTROL [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
【问题讨论】:
标签: mongodb macos authentication homebrew