How MongoDB is used

Source: Internet
Author: User
Tags auth mongodb

1. First open Cmd.exe with administrator, start cmd Command window. 2. In the window, enter Mongod--dbpath "D:\mongodb\data\db"--logpath "D:\mongodb\data\log\mongodb.log"--auth3. Create User and passwordinto the bin directory,input Command Use adminthen Db.adduser (' root ', ' root ')//3.XXX version above can use the following to use CreateUseror Db.createuser ({User: "Root",pwd: "Root",roles: [{role: ' Useradminanydatabase ', db: ' admin '}]})4. Authenticated User login Mongo--host 192.168.192.10--port 27017-u "root"-P "root"--authenticationdatabase "admin" User login switch to admin database user Admin db.auth (' root ', ' root '); Return 1 hint has landed successfully 5. Modify User password use Admindb.changeuserpassword ("username", "xxx") to view the user Db.system.users.find () in the current library

How MongoDB is used

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.