Dylan Lott
Dylan Lott

Reputation: 421

I have to run mongod --dbpath every time I want to start Mongo

I have MongoDB installed and working on my computer (Using Ubuntu 14.04 for the operating system).

The problem is, every time I go to start it, it takes me messing with it for a few minutes before I can get it to successfully start. Usually, some combination of running

mongod --dbpath ~/data/db

or

rm -rf ~/data/db/mongod.lock

or finding and killing the running but broken isntance with

ps wuax | grep mongo
kill <pid>

is what it takes to get it working again. What would cause this? Every time I google this issue, it's all the same answers to just get it fixed, but not permanently make it start and stop correctly, just to fix it when it happens incorrectly.

Upvotes: 1

Views: 803

Answers (1)

danleyb2
danleyb2

Reputation: 1068

i had the same issue of having to specifying --dbpath every time so i just created the two folders /data/db in my root directory and now had just to type mongod to start MongoDB. Note that this requires superuser privileges. Hope it helps

Upvotes: 1

Related Questions