Unable to connect to mongodb Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112

后端 未结 17 1177
不知归路
不知归路 2021-02-02 14:45

When ever I try to connect to mongo db I always get this error as below.

MongoDB shell version: 2.4.3 connecting to: test Fri Apr 26 14:31:46.941 JavaScript execution f

17条回答
  •  萌比男神i
    2021-02-02 15:09

    Please Start the MongoDB server first and try to connect.

    Pre-requisite:

    Create space for storing DB and tables in any directory Example (windows): D:\mongodbdata\

    Steps:

    1. Start server

      mongod --port 5000 --dbpath D:\mongodbdata\ (please mention above created path)

    2. Connect mongodb server (Run in another terminal/console)

      mongo --port 5000

提交回复
热议问题