What i want to do: change dbpath of mongodb from /var/lib/mongodb to /home/user/mongodb/data
im using db version v3.4.7
what i've done
mkdir -p ~/mongodb/data
sudo chown -R mongodb:mongodb /home/user/mongodb
change /etc/mongodb.conf
storage:
dbPath: /home/user/mongodb/data/
journal:
sudo mongod -f /etc/mongod.conf
this works. Also tried
sudo mongod --dbpath /home/user/mongodb/data/
command works fine
sudo service mongod start
command fails. checking the log file.
Permission denied: "/home/user/mongodb/data/mongod.lock", terminating
what is going on? I've tried everything i know. even tried setting chmod 777 to the lock file, and still has permission denied.