Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061

后端 未结 17 2206
醉话见心
醉话见心 2020-11-29 19:12

Here is my mongod.cfg file:

bind_ip = 127.0.0.1
dbpath = C:\\mongodb\\data\\db
logpath = C:\\mongodb\\log\\mongo-server.log
verbose=v

相关标签:
17条回答
  • 2020-11-29 19:27

    This is how I solved it, You can follow step by step here:

    MongoDB Steps:

    • Download the latest 64-bit MSI version of MongoDB for Windows.

    • Run the installer (.msi file)

    • Add it to your PATH of environment variables. it Should be from:
      C:\Program Files\MongoDB\Server\3.0\bin

    now Create a “\data\db” folder in C:/ which is used by mongodb to store all data. You should have this folder:

    C:\data\db

    Note: This is the default directory location expected by mongoDB, don’t create anywhere else

    .

    Finally, open command prompt and type:

    >> mongod
    

    You should see it asking for permissions (allow it) and then listen to a port. After that is done, open another command prompt, leaving the previous one running the server.

    Type in the new command prompt

    >> mongo
    

    You should see it display the version and connect to a test database.

    This proves successful install!=)

    Reference link

    0 讨论(0)
  • 2020-11-29 19:28

    mongodb 2.6.8 on windows7 32bits you only need create a folder c:/data/db execute mongod, and execute mongo

    0 讨论(0)
  • 2020-11-29 19:29

    What solved my issue was creating a file startmongo.conf that sets the bind_ip to 127.0.0.1 . After that, I just created a *.bat to start the mongo using something like:

    mongod --config c:\mongodb\bin\startmongo.conf
    
    0 讨论(0)
  • 2020-11-29 19:30

    The problem is that I missed out 'db' folder for the dbpath in the command:

    C:\mongodb\bin> mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongodb.log --logappend -rest --install
    
    0 讨论(0)
  • 2020-11-29 19:34

    just create a folder

    C:\data\db 
    

    Run below commands in command prompt

    C:\Program Files\MongoDB\Server\3.4\bin>mongod
    

    Open another command prompt

    C:\Program Files\MongoDB\Server\3.4\bin>mongo
    
    0 讨论(0)
  • 2020-11-29 19:34

    Change file permission to 755 for the file:

    /var/lib/mongodb/mongod.lock
    
    0 讨论(0)
提交回复
热议问题