Mongodb connection error


Linix Penguin

After installing Mongodb for the first time in Linux Mint 21.1 and creating a test database all was working well. The next day i attempted to connect to the Mongodb shell using the terminal and mongosh executable. I was presented with this error:

mongooseserverselectionerror: connect econnrefused 127.0.0.1:27017

Linux Terminal

After searching the web for answers, I didn’t find a solution to my situation, many youtube videos for the error message, but on Windows machines. They did give me a clue though, all the videoads went to the windows service manager and added the start command to the mongod service. I used the same idea with the “systemctl” command in Linux. I used the following two lines to get the mongod service running.

sudo systemctl start mongod

sudo systemctl enable mongod

Leave a comment

Your email address will not be published. Required fields are marked *