简体   繁体   中英

Mongodb error: couldn't connect to server 127.0.0.1:27017 connection refused

I downloaded mongodb-bin and mongodb-tools-bin in AUR.I just typed sudo systemctl enable mongodb and just ran mongo.This is the error i got:

$ mongo
MongoDB shell version v5.0.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1

I saw somebody say to just delete /var/lib/mongodb/mongod.lock but when i checked there was no mongod.lock file

I have fixed the problem by deleting /tmp/mongodb-27017.sock.I have found the answer here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM