Bikki Mahato
Bikki Mahato

Reputation: 136

IllegalOperation: Attempted to create a lock file on a read-only directory MongoDB in Windows

I was getting this error when I was trying to change my dbpath

mongod --dbpath "C:\Program Files\MongoDB\Server\4.2\db"

Upvotes: 0

Views: 3456

Answers (1)

Bikki Mahato
Bikki Mahato

Reputation: 136

I fixed it in 2 ways:

First, using cmd as an administrator then it worked

Second, changing my drive to some other drive.

mongod --dbpath "D:\MongoDB Self\db"

If you have any other solutions please let me know.

Upvotes: 4

Related Questions