MongoDB3.4 installation configuration and connection to Robomongo1.1-resolves a problem with authentication failed that is not connected

Source: Internet
Author: User
Tags auth robomongo

This article environment: WIN10 (+MONGODB) (3.4.5) +robomongo (1.1)

Directory:

    1. The installation of MongoDB
    2. Configuration of MongoDB
    3. Installation of Robomongo and connection to MongoDB
    4. Some of the newly emerging moths

First, the installation of MongoDB

Step1. Open the MongoDB product download page https://www.mongodb.com/download-center?jmp=nav#community, select Windows Server R2 64-bit and later, With the SSL support x64, click Download. The current download version is mongoDB3.4.5

Step2. Double-click the installation package that you downloaded in the previous step, follow the instructions in the Installation Wizard, always next, select Complete, and finally finish, the installation is successful. Note the installation directory for MongoDB

Ii. Configuration of MongoDB

Step1. Open the MongoDB bin and remember its path, mine is in C:\Program Files\mongodb\server\3.4\bin. Next, Win+r-cmd, open the command line, then CD C:\Program Files\mongodb\server\3.4\bin, and the next configuration of MongoDB will take place in this path.

Step2. Where to create the database file

\bin>mongod, the dbpath=c:\data\db\ is specified here by default, but we need to create the data\db\ in the C packing directory, otherwise this step will appear "dbpath=c:\data\db\ not found" error prompt. Don't worry about it. Warning:access is not enabled for the database

In addition, we can specify Dbpath=d:\my test\data\db on its own, provided that it has been created, or not found error prompt. The command line can be knocked like this ... bin>mongod--dbpath "D:\my test\data\db". Don't worry about it. Warning:access is not enabled for the database

Step3. Enter the URL in the browser: http://localhost:27017/. If the service starts successfully, you will see the following paragraph:
It looks like you is trying to access MongoDB over HTTP on the native driver port.

Step4. Step2. cmd window do not close, back to the Bin folder, Administrator run Mongo.exe.

Try typing the following command: DB; Use admin; Db.auth ("admin", "admin")

>dbtest> Useadminswitched to DB admin

When we typed Db.auth ("admin", "admin"), it returned to 0 and appeared error:authentication failed. And that's why Robomongo can't connect.

>db.auth ("admin", "admin")
Error:authentication failed.
0

The workaround is to manually add the admin account, after the creation succeeds, again Db.auth ("admin", "admin"), return 1

>db.createuser ({User:"Admin", pwd:"Admin", roles: [{role:"Useradminanydatabase"Db:"Admin" } ]    }  ) 
successfully added User: {
        "user": "admin",
        "Roles" : [
                {
                          "Role": "Useradminanydatabase",
                         "db": "Admin"
               }
        ]
}  
>db.auth ("admin","admin")1

Observe the status in the command line and display the successful authorization successfully authenticated.

Iii. installation of Robomongo and connection to MongoDB

Step1. First download Robomongo, the official website download link https://robomongo.org/download, according to download down the Installation Wizard, the fool installs can. Installation Version Robo 3T 1.1

Step2. Connection to MongoDB

Robo 3T 1.1:file--connect--create--connection:name--authendication: Check perform authendication

    • Do not tick perform authendication--test. Note: Even if the second part of Step4 Db.auth ("admin", "admin") returns 0, you can also connect

    • Tick perform Authendication--user Name, Password--test. Note: The second part of the Step4 Db.auth ("admin", "admin") returns 0/1, which affects the connection here

The second part Step4 in Db.auth ("admin", "admin") returns 0

The second part Step4 in Db.auth ("admin", "admin") returns 1

Iv. the newly emerged moth

    1. The network hangs the machine, causes the second part Step4 already added admin invalidation: Db.auth ("admin", "admin") returns 0, needs to add again;
    2. Once you exit Mongo.exe, you will need to re-configure the MongoDB (configuration of the command line and configure the administrator to run Mongo.exe), which is very cumbersome

Above the moth look forward to the big God solve!

MongoDB3.4 installation configuration and connection to Robomongo1.1-resolves a problem with authentication failed that is not connected

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.