• 终端命令 启动MongoDB服务: sudo mongod

  • 报出如下错误,表示默认的存储数据目录 /data/db 不存在:

  •  [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating

  • 解决方法:

    • 创建 /data目录和 /data/db 目录,并指定 读/写/执行 权限:
      • python@ubuntu:~$ sudo mkdir -p /data/db

      • python@ubuntu:~$ sudo chmod 777 /data/db
        (再次启动服务器sudo mongod,就会发现不会报错了)
         

posted on 2018-04-15 15:45  Xiao马  阅读(5411)  评论(0编辑  收藏  举报