时间:2021-07-01 10:21:17 帮助过:4人阅读
The error message is showing that you do not have permission to access yourdb.ns database. Check the MongoDB data directory /data/db/ , the database yourdb.ns belongs to the root user.
$ ls -ls /data/db
      0 drwxr-xr-x  2 mkyong  wheel          68 Mar  8 22:54 journal
 131072 -rw-------  1 root    wheel    67108864 Mar  7 17:01 yourdb.0
 262144 -rw-------  1 root    wheel   134217728 Mar  7 16:15 yourdb.1
  32768 -rw-------  1 root    wheel    16777216 Mar  7 17:01 yourdb.ns
$whoami
mkyong
To fix it, assign permission to the database.
$ sudo chown -R mkyong /data/db
$ ls -ls /data/db
      0 drwxr-xr-x  2 mkyong  wheel          68 Mar  8 22:54 journal
 131072 -rw-------  1 mkyong  wheel    67108864 Mar  7 17:01 yourdb.0
 262144 -rw-------  1 mkyong  wheel   134217728 Mar  7 16:15 yourdb.1
  32768 -rw-------  1 mkyong  wheel    16777216 Mar  7 17:01 yourdb.ns
 
转自:
http://www.mkyong.com/mongodb/mongodb-couldnt-open-datadbyourdb-ns-errno13-permission-denied/
MongoDB : couldn’t open /data/db/yourdb.ns errno:13 Permission denied
标签: