has been running on this machine, the previous period of time to the background rack to the cloud server, in the settings added username and password, hoping to synchronize the time to modify the settings can be tested locally. Because the cloud server-side database connection needs to be validated, it is also intended to be authenticated locally, and MongoDB is not validated by default. Search on the Internet, methods are relatively old, mainly in the local MongoDB add a user: Into the bin under MongoDB
MongoDB $ cd Bin
Start MongoDB without turning on authentication
Bin $./mongod-dbpath. /blog
Enter the MONGO command to enter the test database
Bin $./mongo
Add Admin user
1 Use admin2 Db.createuser ({3User'Admin',4 pwd:'Admin',5Roles:[{role:'Useradminanydatabase'Db:'Admin'}]6})
Switch to my database (blog for my database name), create a user under my database
1 Use blog2 Db.createuser ({3User'testuser',4 pwd:'Test',5Roles:[{role:'Dbowner'Db:'Blog'}]6})
Restart the server to enable authentication
Bin $./mongod-dbpath. /blog--auth
Login with Robomongo, display authentication Failed, view server log: 2015-08-31t17:39:46.416+0800 I ACCESS [conn46] Failed to authenticate [ Email protected] With mechanism mongodb-cr:authenticationfailed MONGODB-CR credentials missing in the user document to view the documentation, The discovery is because the MongoDB authentication method changes, joined (SCRAM) SHA-1 in the MONGO will just create the user to delete
Use blogdb.dropuser ('testuser')
Turn off verify restart database in MONGO modify the Authschema version of the System.version document to 3 (old version)
1 Use admin 2 db.system.version.update ({'_id':'authschema' },{$set: {'currentversion':3}})3 Db.system.version. Find ()
can see: {"_id": "Authschema", "CurrentVersion": 3}Delete the previously created user,Re-create the user (this time using authentication as MONGODB-CR)
1 Use blog2Db.dropuser ('testuser')3 Db.createuser ({4User'testuser',5 pwd:'Test',6Roles:[{role:'Dbowner'Db:'Blog'}]7})
This time can be successfully landed with Robomongo ~
MongoDB authentication Method (version:3.0.4)