mongodb创建用户
生活随笔
收集整理的這篇文章主要介紹了
mongodb创建用户
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1:創(chuàng)建管理員
D:\mongodb\bin\mongo --port 27017 MongoDB shell version v4.2.15 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("df917c43-c160-41af-8f13-ad42e0a31abe") } MongoDB server version: 4.2.15 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, seehttps://docs.mongodb.com/ Questions? Try the MongoDB Developer Community Forumshttps://community.mongodb.com Server has startup warnings:> use admin switched to db admin > db.createUser({user: "root", pwd: "eshop", roles: [{role: "root", db: "admin"}]}) Successfully added user: {"user" : "root","roles" : [{"role" : "root","db" : "admin"}] } >user: "用戶名", pwd: "密碼"
2:數(shù)據(jù)庫用戶
use testdb
db.createUser({user: "test", pwd: "test", roles: [{role: "readWrite", db: "testdb" }]})
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的mongodb创建用户的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: centos8中一键安装Nginx
- 下一篇: centos8安装mongodb5