Error: Authentication failed when installing for Windows



  • Hello,

    I'm following the Windows tutorial with this link

    Everything was working smoothly until I got to this step

    mongo -u admin -p your_password --authenticationDatabase=admin

    MongoDB shell version v4.4.1
    connecting to: mongodb://127.0.0.1:27017/?authSource=admin&compressors=disabled&gssapiServiceName=mongodb
    Error: Authentication failed. :
    connect@src/mongo/shell/mongo.js:374:17
    @(connect):2:6
    

    This is the error I got even though I put in the right password.

    Command I ran:

    C:\Program Files\MongoDB\Server\4.4\bin>mongo -u admin -p ojorocks --authenticationDatabase=admin
    

    When I press show users in admin this is the output

    > show users
    {
            "_id" : "admin.admin",
            "userId" : UUID("e3c3df1d-f63d-48e3-ae65-b9cf03c86333"),
            "user" : "admin",
            "db" : "admin",
            "roles" : [
                    {
                            "role" : "root",
                            "db" : "admin"
                    }
            ],
            "mechanisms" : [
                    "SCRAM-SHA-1",
                    "SCRAM-SHA-256"
            ]
    }
    {
            "_id" : "admin.admin2",
            "userId" : UUID("0b87390b-2c08-4e21-9183-8a2406a9304e"),
            "user" : "admin2",
            "db" : "admin",
            "roles" : [
                    {
                            "role" : "root",
                            "db" : "admin"
                    }
            ],
            "mechanisms" : [
                    "SCRAM-SHA-1",
                    "SCRAM-SHA-256"
            ]
    }
    

    I am truly confused did I miss something? I even created an extra admin acct and it didnt work for that either.


  • Global Moderator

    I think after changing mongod.cfg you shouldn't be able to connect without authenticating correctly. Please post your mongod.cfg and the output when you run net stop MongoDB and net start MongoDB



  • @PitaJ Thanks or the reply! I really need help.

    Here is where it is located. C:\MongoDB.

    Here is what it has:

    systemLog:
        destination: file
        path: C:\MongoDB\logs\mongod.log
    storage:
        dbPath: C:\MongoDB\data\db
    security:
      authorization: enabled
    


  • Net stop:

    net stop MongoDB
    The MongoDB Server (MongoDB) service is stopping.
    The MongoDB Server (MongoDB) service was stopped successfully.
    

    Net start:

    C:\WINDOWS\system32>net start MongoDB
    The MongoDB Server (MongoDB) service is starting..
    The MongoDB Server (MongoDB) service was started successfully.
    

Log in to reply
 

Suggested Topics

| |