MongoDB Compass connect ECONNREFUSED 127.0.0.1:27017

Hello. I am new to MongoDB and using as it is part of a LYNDA course. I am running on MacOS. I am getting
“connect ECONNREFUSED 127.0.0.1:27017” error message. Not really sure where to take from here and would appreciate suggestions.

Most likely you do not have a server running at 127.0.0.1:27017.

How did you start mongod?

You can check if you have a local mongod running by using ps piped into grep.

jd10gen:~ jdrumgoole$ ps -alx | grep mongod
  501 59462 43689     4006   0  31  0  5565448  30692 -      S+                  0 ttys000   11:13.09 mongod --dbpath data
  501 43892 35381     4006   0  31  0  4287756    744 -      S+                  0 ttys002    0:00.00 grep mongod
jd10gen:~ jdrumgoole$

If mongod is running you will get two lines, if not, one line. To start a mongod process just run:

$ mkdir $HOME/data
$ mongod --dbpath $HOME/data

This assumes mongod is on your path. To download and install mongod goto https://www.mongodb.com/try/download/community and download the installation package
for MongoDB on OSX (MacOS).