Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

前端 未结 27 2525
孤街浪徒
孤街浪徒 2020-12-12 15:06

while trying this mongo command in ubuntu I am getting this error.

    ritzysystem@ritzysystem-Satellite-L55-A:~$ mongo
    MongoDB shell version: 2.6.1
             


        
相关标签:
27条回答
  • 2020-12-12 15:34

    For mongo v3.6.3+ (or 2019 versions)

    rm /var/lib/mongodb/mongod.lock
    service mongodb restart
    
    0 讨论(0)
  • 2020-12-12 15:37

    In my case bind_ip was not 127.0.0.1 in /etc/mongodb.conf file so change bind_ip to 127.0.0.1(it may be comma separated values so make sure 127.0.0.1 is one of them) Then restart your system to take effect. Restart only to the those who are facing

    $sudo service mongod restart
    Failed to restart mongod.service: Unit mongod.service not found.
    
    0 讨论(0)
  • 2020-12-12 15:37

    I solved that simply by entering sudo mongo after mongod command.

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