Mac 安装和使用MongoDB
来源:互联网 发布:seo外包顾问服务 编辑:程序博客网 时间:2024/06/06 13:03
- 安装
- 尝试一:手动命令安装
- 尝试二:采用Homebrew
- 尝试三:下载安装包
- 使用
安装
尝试一:手动命令安装
按照官网https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/说明,手动命令安装
1.下载所需版本的MongoDB的二进制文件
curl -O https://fastdl.mongodb.org/osx-ssl/mongodb-osx-ssl-x86_64-3.4.10.tgz
2.解压
tar -zxvf mongodb-osx-ssl-x86_64-3.4.10.tgz
报错:
tar: Unrecognized archive formattar: Error exit delayed from previous errors.
试过很多方法都没有解决,后续找到解决方法再更。。
尝试二:采用Homebrew
首先得安装Homebrew,结果安装Homebrew时失败。。。
报错:
Error: Checksum mismatch....To retry an incomplete download, remove the file above.Error: Failed to install vendor Ruby.
然后过了一晚上,第二天重试了一次一把就安装上了、、、莫名其妙、、、
查看home-brew版本:
brew -v
安装之前先更新
brew update
安装
brew install mongodb --with-openssl
安装的过程中遇到下载失败的问题,请参考:
http://www.jianshu.com/p/ac4b23c4ebab
brew --cache
查看brew缓存地址 mongod -version
查看mongodb版本尝试三:下载安装包
下载链接:https://www.mongodb.com/download-center#community
参考:https://www.cnblogs.com/quickcodes/p/5390482.html
open -e ~/.bash_profile
打开配置环境变量的文件 source ~/.bash_profile
使配置生效使用
启动和停止mongodb数据库
方法一:使用bash终端
- 启动
mongod --config /usr/local/etc/mongod.conf # 启动或mongod --dbpath . # 启动
启动成功后可以在mac的“活动监视器”中看到进程mongod
,停止则关闭进程。
- 停止:
使用command+T
在同一窗口中建立多标签终端,在新的bash中输入:
mongo # 进入mongo命令行> use admin> db.shutdownServer() # 停止> ctrl+C # 退出mongo命令行
进入mongo命令行可以在mac的“活动监视器”中看到进程mongo
,退出则关闭进程。
方法二:使用homebrew
brew services start mongodb # 启动brew services stop mongodb # 停止
阅读全文
0 0
- Mac 安装和使用MongoDB
- mac下mongodb的安装和使用(使用终端操作)
- mac环境下mongodb的安装和使用
- 安装mongodb和使用mongodb
- Mongodb安装和使用
- Mongodb安装和使用
- Mongodb安装和使用
- MongoDB 安装和使用
- mongoDB安装和使用
- 安装和使用MongoDB
- mac 10.9.3 mongoDB安装及使用
- mac mongodb安装及使用记录
- Mac OSX下使用Homebrew安装MongoDB
- Mac下使用brew安装mongodb
- Mac下使用brew安装mongodb
- Mac OS上安装使用MongoDB
- Mac下使用HomeBrew安装MongoDb
- Mac下使用brew安装mongodb
- SpringMVC与安卓之间的交互1
- 【写给李美琦的,其他人别看】
- 1043. 输出PATest(20)
- The declared package does not match the expected package
- gcc,g++,gdb的简单安装
- Mac 安装和使用MongoDB
- [arc068f]Solitaire
- [转载]文献关键词共现矩阵python实现
- 1175级数求和问题
- 9.1 构造器与垃圾收集器
- 细讲android获取流量使用情况,以及解决调用流量接口不准问题(非TrafficStats,而是NetworkStatsHistory)
- Correct Path解题方法
- Spring3中js/css/jpg/gif等静态资源无法找到(No mapping found for HTTP request with URI)问题解决
- java.sql.SQLException: ORA-28000: the account is locked