I installed mongodb on my mac but, as I can see now, I installed it using root privileges and it starts on system startup. Whenever I try to change the location of the default data folder using mongod --dbpath I get the following set of errors:
[initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
[initandlisten] ERROR: addr already in use
[websvr] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:28017
[initandlisten] now exiting
[websvr] ERROR: addr already in use
When I run lsof -i 4 -a
I see that 27017 is used by mongo. The other one is used for web processes of mongo (I assume). I tried to kill the processes by using port number lsof -i tcp
but it doesn't help. When I try to change path the same thing happens. I don't know what to do at this point because I have to store data on external hard drive.