install mongodb with homebrew

Open the Terminal and type brew update.
downloading Mongo brew install mongodb
create the "db" directory. This is where the Mongo data files will live. Ensure that the directory is set up in the right place so that Mongo can find it

sudo mkdir -p /data/db/

Make sure that the /data/db directory has the right permissions by running

$ sudo chown -R `id -un` /data/db

Run the Mongo daemon, in one of your terminal windows run mongod. This should start the Mongo server.
Run the Mongo shell, with the Mongo daemon running in one terminal, type mongo in another terminal window. This will run the Mongo shell which is an application to access data in MongoDB.
To exit the Mongo shell run quit()
To stop the Mongo daemon hit ctrl-c

Note

you can override the default db path using the --dbpath argument of mongod( or use a config file).

mongod --dbpath /var/lib/mongodb/data/db

start using mongodb see my github:
https://github.com/HoweZZH/CS546/tree/master/lab3

recommendation:
Robomongo a MongoDB GUI management tool

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容