8 月 222016
 

创建账号

use admin
db.createUser({ user: “admin”,pwd: “javaqwe”,roles: [ { role: “root”, db: “admin” } ]})

use rizhi
db.createUser({ user: “rizhi_read”,pwd: “javaqwe”,roles: [ { role: “read”, db: “rizhi” } ]})
db.createUser({ user: “rizhi”,pwd: “javaqwe”,roles: [ { role: “readWrite”, db: “rizhi” } ]})

删除账号

db.system.users.remove({user:”test”})

参考url:http://www.cnblogs.com/zhoujinyi/p/4610050.html

mongo 3.0 跟 mongo 2.0的配置是不一样的。

3.0 的配置如下:

security:
    authorization: enabled 

2.0的配置可以参考url。

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny