OK, so this shows that mongod
is running and explains why you can connect via either mongo
or mongosh
. It also explains why you are not able to start the process using brew start ...
.
The 0 in the first column of the first line show that is running under the root
user which is not good. I would run kill 334
to stop that process and then brew service start mongodb-community
to allow brew
to run the process.
One thing to note here is that since the process is currently running as root
, that user probably owns the directories and files and those will need to be either deleted or have their ownership changed to your normal user so brew start ...
does not fail due to permission issues.
I can’t stress this enough, you should never run a service/daemon as the root
user unless explicitly told to do so, and even then only do it as long as you understand the risks involved with doing so.