0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MongoDB の dbPath 変更後、`Permission denied: "/path/to/mongod.lock"` を解消する

Posted at

dbPath 変更後、Permission denied: "/path/to/mongod.lock" に悩まされました。権限周りは問題なさそうなのだが。

MongoDB を停止する

sudo service mongod stop

データベースの保存先を変更する

sudo vi /etc/mongod.conf
#  dbPath: /var/lib/mongodb
  dbPath: /path/to

データベースを移動する

mv /var/lib/mongodb/ /path/to

sudo chown -R  mongodb /path/to

一個上のディレクトリに r, x の権限を付与する

sudo chmod +r /path
sudo chmod +x /path

このように一個上のディレクトリに権限を与えたら解決しました。

参考 https://dba.stackexchange.com/questions/254682/permission-denied-on-mongod-lock-despite-it-being-owned-by-mongodb

MongoDB を開始する

sudo service mongod start

環境

  • Ubuntu 18.04.3 LTS
  • MongoDB 4.0.14
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?