Reputation: 5929
Hi I have problem when I run
mongod
This is what I got
2016-02-09T21:54:40.631-0700 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-02-09T21:54:40.633-0700 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-02-09T21:54:40.633-0700 I CONTROL [initandlisten] dbexit: rc: 100
I try everything uninstall mongo. Install with brew. Uninstall with brew etc. Change the permission of my data folder and get always the same problem.
Upvotes: 2
Views: 13027
Reputation: 11
systemctl enable mongod.service
Start mongod service at system startup
service mongod start
Upvotes: -1
Reputation: 123
I was having the same issues until I ran
sudo chown -R 'youruserid' /data/db
it seems some file(s) in the directory still had the wrong permissions.
Upvotes: 5
Reputation: 5929
So this is what I did. I delete the /data/db folder after a recreate it with
sudo mkdir -p /data/db
Change the permission of data and db folder
mongod
everything working. My error was I didn't change the permission before I run mongod for the first time now everything is working fine.
Upvotes: 7
Reputation: 467
I think I had a similar problem with my mongo install in my Mac. Have you tried changing the owner of /db/data?
You can check who owns this directory (where the databases are stored) by writing the following command in the terminal.
ls -al /data/db
If the owner (the name in the third column) is not your user, change it with a chown command or try running mongod with sudo.
Upvotes: 4
Reputation: 6312
I would first check to see if you have another instance of mongo running as it suggests. If you do not - remove the lock file in question and try to launch mongo again. It is possible the lock file is a remnant of a previous install.
Upvotes: 0