Unable to connect to MongoDB

前端 未结 9 1120
借酒劲吻你
借酒劲吻你 2021-02-02 11:17

I\'ve just installed MongoDB (standard Ubuntu build, not the latest stable) and for some reason I can\'t connect:

Mon Feb  6 03:11:22 Error: couldn\'t connect to         


        
9条回答
  •  暖寄归人
    2021-02-02 11:48

    By default, running the mongo console command will look for mongodb on your localhost, hence the 127.0.0.1 IP which is your local loopback. Also, the default config for mongod should be available on localhost. Its better to do it this way for now to start, unless you have turned on auth. Make sure you have auth enabled or your database is running openly on your public ip.

    When you want to connect to a host other than localhost or your default config, you do:

    mongo 
    

提交回复
热议问题