Connor Black
Connor Black

Reputation: 7181

Can't connect to local mongoDB install

After downloading, extracting, creating the data/db folder and cd-ing into where I extracted mongoDB, I tried running this command, as directed by the official mongoDB install instructions: .bin/mongo/ but I keep getting this error:

Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91

I can't find a concise explanation on the internet, though it seems to be a common problem, and the mongoDB docs aren't clear either. Can anyone help me out?

Upvotes: 0

Views: 1384

Answers (1)

jdi
jdi

Reputation: 92569

Start the server before trying to connect with a client:

mongod

Or if you want to specifically point it at a db location, and log to a log file:

mongod --logpath /data/log/mongo.log --dbpath /data/db

Or something of this nature. This command will run the server in a foreground process. You can use --fork to daemonize it.

Upvotes: 3

Related Questions