Error: couldn't connect to server 127.0.0.1:27017

Error
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
QUERY [js] 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:341:17
@(connect):2:6
[main] exception: connect failed
[main] exiting with code 1

solution.

service mongod stop
#dont start mongod…instead…

systemctl start mongod
#then mongo command

mongo

4 Likes