Local Mongo on Windows - couldn't connect to server 127.0.0.1:27017, connection attempt failed

10,690

Solution 1

I got the same error this is how i solved it. open your task manager click on service tab check for Mongo Db service and right click restart it. hopefully this will solved it.

Solution 2

First, you should install Mongodb as a service,

  • Open your cmd as admin
  • Run ( net start mongodb )
  • Now you can run the command ( mongo ) and you will be able to connect normally, with no Problem.

Solution 3

You have to start the server process first.
https://docs.mongodb.org/v3.0/tutorial/install-mongodb-on-windows/#run-mongodb

Share:
10,690
aaa
Author by

aaa

Updated on June 07, 2022

Comments

  • aaa
    aaa almost 2 years

    Installed Mongo 3.2 on Windows 8.1. Got this:

    c:\foo>"c:\Program Files\MongoDB\Server\3.2\bin\mongo.exe"
    MongoDB shell version: 3.2.5
    connecting to: test
    2016-04-26T13:41:31.032+0100 W NETWORK  [thread1] Failed to connect to 127.0.0.1
    :27017, reason: errno:10061 No connection could be made because the target machine actively refused it.
    2016-04-26T13:41:31.034+0100 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
    connect@src/mongo/shell/mongo.js:229:14
    @(connect):1:6
    
    exception: connect failed
    
    c:\foo>ver
    
    Microsoft Windows [Version 6.3.9600]
    

    Why?

    What else can I say?