运行mongo.exe
>use demo //切换到要创建用户的数据库 >db.createUser({user: "admin",pwd: "admin",roles: [ { role: "readWrite", db: "demo" } ]}); //用户名密码任意
显示success提示表示创建成功
时间: 2024-12-27 10:31:33
运行mongo.exe
>use demo //切换到要创建用户的数据库 >db.createUser({user: "admin",pwd: "admin",roles: [ { role: "readWrite", db: "demo" } ]}); //用户名密码任意
显示success提示表示创建成功