MongoDB on a Windows 7 machine: No connection could be made

前端 未结 14 1682
渐次进展
渐次进展 2020-12-02 10:39

After I have started Mongo using mongod.exe on a Windows 7 machine, I tried to start the mongo shell that failed with the error:

Failed to connect to

相关标签:
14条回答
  • 2020-12-02 11:27

    I found my answer on this page. https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-3.1&tabs=visual-studio So, first, make a folder for your data; then, open one command shell

    mongod --dbpath <data_directory_path>
    

    then, open another shell, do whatever you want to do. You can see in MongoDB Compass, there are collections if you had one before.

    0 讨论(0)
  • 2020-12-02 11:28

    In Windows 10: Executing below command restarts mongodb service (as administrator), required if there is a system restart after mongodb installation.

    net start mongodb 
    

    Also make sure to check, if there is a MongoDBInstallation folder/data and /data/db folder created, same can be obtained at MongoDBInstallation\bin\mongod.cfg

    mongod --dbpath=c:\MongoDBInstallation\data\db
    
    0 讨论(0)
提交回复
热议问题