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

后端 未结 8 1193
别那么骄傲
别那么骄傲 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:53

    Try to remove /var/lib/mongodb/mongod.lock and restart mongdo service

    sudo rm /var/lib/mongodb/mongod.lock
    sudo service mongodb restart
    
    0 讨论(0)
  • 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 <user> -p <pass> --host <host> --port your_new_port_number
    

    from MongoDB docs

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