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

后端 未结 8 1200
别那么骄傲
别那么骄傲 2021-01-30 01:25

I can\'t connect to MongoDB. In Ubuntu it works, but I\'m working in CentOS now. This is the error message:

MongoDB shell version: 2.4.2
connecting

8条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 01:59

    You also get this error if you've changed the default port for mongoDB in /etc/mongo.conf

    To connect via the shell in this case use:-

    $mongo 127.0.0.1:your_new_port_number
    

    OR

    $mongo -u  -p  --host  --port your_new_port_number
    

    from MongoDB docs

提交回复
热议问题