New to MongoDB Can not run command mongo

前端 未结 15 1941
孤独总比滥情好
孤独总比滥情好 2021-01-29 20:00

I was trying to run MongoDB:

   E:\\mongo\\bin>mongod
    mongod --help for help and startup options
    Sun Nov 06 18:48:37
    Sun Nov 06 18:48:37 warning:          


        
相关标签:
15条回答
  • 2021-01-29 20:10

    If you're using Windows 7/ 7+.

    Here is something you can try.

    Check if the installation is proper in CONTROL PANEL of your computer.

    Now goto the directory and where you've install the MongoDB. Ideally, it would be in

    C:\Program Files\MongoDB\Server\3.6\bin

    Then either in the command prompt or in the IDE's terminal. Navigate to the above path ( Ideally your save file) and type

    mongod --dbpath

    It should work alright!

    0 讨论(0)
  • 2021-01-29 20:13

    Also check if you have installed the Mongo as a windows service and if its running. That's also important. There might port conflict because of that.

    0 讨论(0)
  • 2021-01-29 20:15

    Specify the database path explicitly like so, and see if that resolves the issue.

    mongod --dbpath data/db
    
    0 讨论(0)
  • 2021-01-29 20:15

    For Windows 7

    You may specify an alternate path for \data\db with the dbpath setting for mongod.exe,

    as in the following example:

    c:\mongodb\bin\mongod.exe --dbpath c:\mongodb\data\db
    

    or

    you can set dbpath through Configuration File.

    0 讨论(0)
  • 2021-01-29 20:16

    Check that path to database data files exists ;) :

    Sun Nov 06 18:48:37 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db) does not exist, terminating

    0 讨论(0)
  • 2021-01-29 20:16

    You should create a startup.bat if you're using Windows, much more convenient:

    C:\mongodb\mongodb-win32-x86_64-eiditon\bin\mongod.exe --dbpath C:\mongodb\data
    

    And just dbclick startup.bat and mongodb will run using C:\mongodb\data as its data folder.

    0 讨论(0)
提交回复
热议问题