且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用用户名和密码保护MongoDB

更新时间:2022-02-01 15:06:45

设置用户后,需要使用--auth选项启动mongod.

You need to start mongod with the --auth option after setting up the user.

从MongoDB站点:

From the MongoDB Site:

使用--auth选项运行数据库(mongod进程)以启用 安全.您必须先将用户添加到admin数据库中 使用--auth启动服务器,或从 本地主机接口.

Run the database (mongod process) with the --auth option to enable security. You must either have added a user to the admin db before starting the server with --auth, or add the first user from the localhost interface.

MongoDB身份验证