I get this when I run mongod -
Johns-MacBook-Pro:~ johnnyringo506$ mongod
2020-02-18T17:12:06.439-0500 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] MongoDB starting : pid=24840 port=27017 dbpath=/data/db 64-bit host=Johns-MacBook-Pro.local
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] db version v4.2.3
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] allocator: system
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] modules: none
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] build environment:
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] distarch: x86_64
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] target_arch: x86_64
2020-02-18T17:12:06.446-0500 I CONTROL [initandlisten] options: {}
2020-02-18T17:12:06.447-0500 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2020-02-18T17:12:06.447-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-02-18T17:12:06.447-0500 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-02-18T17:12:06.447-0500 I CONTROL [initandlisten] now exiting
2020-02-18T17:12:06.447-0500 I CONTROL [initandlisten] shutting down with code:100
And then I receive a "mkdir: /data: No such file or directory" when I try to create it
尝试使用 sudo 运行,问题可能出在权限或使用此命令创建目录 sudo mkdir -p /data/db 然后重新启动 MongoDB 服务
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.