MongoDB: exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating

前端 未结 14 1788
轻奢々
轻奢々 2020-12-02 04:37

I created /data/db in root directory and ran ./mongod:

[initandlisten] exception in initAndListen: 20 Attempted to create a lock fi         


        
14条回答
  •  囚心锁ツ
    2020-12-02 05:14

    Fix the permissions of /data/db (or /var/lib/mongodb):

    sudo chown -R mongodb: /data/db
    

    then restart MongoDB e.g. using

    sudo systemctl restart mongod
    

    In case that does not help, check your error message if you are using a data directory different to /var/lib/mongodb. In that case run

    sudo chown -R mongodb: 
    

    source

提交回复
热议问题