Running sudo systemctl status mongod
resulted in this error.
Here is how i fixed this on ubuntu 20.04.
From image above the mongod service is disabled so let's enable that first using the sudo systemctl enable mongod
.
To fix the issue changing the default port worked for me. Info about the port can be found in the mongod.conf in the etc directory. You need to need root permission to edit this file on ubuntu.
We can use sudo gedit
to open the text editor and edit as a super user. From the text editor we open the .conf file in the etc directory and change the port no from 27017 which is the default to 27020 (can be anything else).
Save the changes and close the file.
Run sudo systemctl start mongod
to start mongodb.
And sudo systemctl status mongod
to verify that mongodb is active. You should get the following output.
If this doesn't work for you here are some links to solutions i tried that didn't work for me:
Changing Permissions
Changing bindIp
Changing Security Settings
Happy fixing!
Top comments (0)