After mongdb has been installed through brew, the contents of /usr/local/etc/mongod.conf are as follows
systemLog: destination: file path: /Users/zyj/database/log/mongodb/mongo.log logAppend: true storage: dbPath: /Users/zyj/database/mongodb journal: enabled: true net: bindIp: 127.0.0.1 port: 27017
Then start the command line to enter mongod and display
exception in initAndListen: 29 Data directory /data/db not found., terminating
How do I customize the database path
mongod --config /usr/local/etc/mongod.conf
Although you have modified the configuration file, you have not made the configuration file effective. You have to execute the command to make the configuration file effective.