内容简介:mongoDB是一个非常不错的数据库,最近也正在学习mongoDB,在使用一个数据库前必不可少的就是安装和卸载,所以下面这篇文章主要给大家介绍了关于Mac系统中mongoDB安装与卸载的相关资料,需要的朋友可以参考借鉴,下面来一起看看吧。
前言
MongoDB 是一个基于分布式文件存储的数据库,旨在为 web 应用提供可扩展的高性能数据存储解决方案。本文主要介绍的是关于在mac中安装卸载 mongoDB 数据库的方法,更多关于mongoDB的使用大家可以参考这篇文章:
(一) mongodb 安装
mongodb 数据库的安装有两种方法。
一种是使用命令行安装,第二种是使用HomeBrew 安装,我按照第二种方式安装。
1.更新Homebrew的package数据库:
$ brew update
2.安装 mongodb
$ brew install mongodb
成功后出现下面一段描述:
Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.4.4.sierra.bottle Already downloaded: /Users/liangma/Library/Caches/Homebrew/mongodb-3.4.4.sierra.bottle.tar.gz ==> Pouring mongodb-3.4.4.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats To have launchd start mongodb now and restart at login: brew services start mongodb Or, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf ==> Summary
3.查看安装列表
$ brew list mongodb (已经存在) ...
4.启动mongodb
$ mongod --config /usr/local/etc/mongod.conf
5.连接mongodb service
$ mongo
6.使用
查看所以数据库
> show dbs admin 0.000GB data_person_info 0.000GB local 0.000GB test 0.000GB
创建数据库
> use data_person_info switched to db data_person_info
查看当前数据库
> db data_person_info
添加表数据(文档)
> db.data_person_info.insert({'id':'0001','name':'bojue','age':'24'}) WriteResult({ "nInserted" : 1 })
查看表数据(文档)
> db.data_person_info.find() { "_id" : ObjectId("59f4c3396564b89187361bfd"), "id" : "0001", "name" : "bojue", "age" : "24" }
(二) mongodb 卸载
$ brew uninstall mongodb $ brew list (已经不存在 mongodb)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 彻底卸载干净oracle 11g
- [译]如何从 Ubuntu 卸载 Redis
- 云设计模式之: 网关卸载模式
- 那些你应该考虑卸载的 VSCode 扩展
- Debian完全卸载清理MySQL服务器
- SSL 是否应当在负载均衡器上卸载?
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Mathematica Cookbook
Sal Mangano / O'Reilly Media / 2009 / GBP 51.99
As the leading software application for symbolic mathematics, Mathematica is standard in many environments that rely on math, such as science, engineering, financial analysis, software development, an......一起来看看 《Mathematica Cookbook》 这本书的介绍吧!