Home Database Mysql Tutorial MongoDB增加用户认证: 增加用户、删除用户、修改用户密码、读写权限、只读权限

MongoDB增加用户认证: 增加用户、删除用户、修改用户密码、读写权限、只读权限

Jun 07, 2016 pm 05:56 PM
mongodb Revise delete Increase password user Certification Read and write

阅读原文: 说明:增加用户是针对数据库进行操作 1.进入到数据库 use dbname 2.针对当前数据库添加用户 权限是针对当前数据 1.添加并验证用户 use admin db.addUser("zjx","tsjianxin") db.auth("zjx","tsjianxin") 2.查看已存在的用户 db.system.users.find(

阅读原文:

说明:增加用户是针对数据库进行操作
1.进入到数据库 use dbname
2.针对当前数据库添加用户 权限是针对当前数据
1.添加并验证用户
> use admin
> db.addUser("zjx","tsjianxin")
> db.auth("zjx","tsjianxin")
2.查看已存在的用户
> db.system.users.find()
3.现在来给另一个数据库51cv配置一个读写权限的用户
> use 51cv
> db.addUser("51cvrw","51cv")
 ..."readOnly" : false...
4.配置一个只读权限的用户
> use 51cv
> db.addUser("51cvr","51cv",true)
> db.system.users.find()
  ..."readOnly" : true...
5.删除用户
> use dbname (admin or 51cv ,etc)
> db.system.users.remove({user:"haha"})
> db.system.users.find()
6.用户登录数据库测试
for:mongod dbname -u uname -p password
mongo admin -u zjx -p tsjianxin
/usr/local/mongodb/bin/mongo admin -u 用户名 -p  密码 --port 端口号

,香港服务器,美国服务器,香港空间
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue? Apr 11, 2024 am 09:10 AM

How to solve the problem that Windows 11 prompts you to enter the administrator username and password to continue?

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Apr 08, 2024 am 11:41 AM

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added?

How to set router WiFi password using mobile phone (using mobile phone as tool) How to set router WiFi password using mobile phone (using mobile phone as tool) Apr 24, 2024 pm 06:04 PM

How to set router WiFi password using mobile phone (using mobile phone as tool)

Which version is generally used for mongodb? Which version is generally used for mongodb? Apr 07, 2024 pm 05:48 PM

Which version is generally used for mongodb?

Tutorial on changing wifi password on mobile phone (simple operation) Tutorial on changing wifi password on mobile phone (simple operation) Apr 26, 2024 pm 06:25 PM

Tutorial on changing wifi password on mobile phone (simple operation)

How to completely delete TikTok chat history How to completely delete TikTok chat history May 07, 2024 am 11:14 AM

How to completely delete TikTok chat history

The difference between nodejs and vuejs The difference between nodejs and vuejs Apr 21, 2024 am 04:17 AM

The difference between nodejs and vuejs

What is the name of the software that can unlock all wifi passwords (recommended mobile software to get connected wifi passwords with one click) What is the name of the software that can unlock all wifi passwords (recommended mobile software to get connected wifi passwords with one click) Apr 02, 2024 pm 06:46 PM

What is the name of the software that can unlock all wifi passwords (recommended mobile software to get connected wifi passwords with one click)

See all articles