Mac启动mongo的问题

本文详细介绍了在Mac上从MongoDB 3.2逐步升级至3.6版本的具体步骤,包括卸载旧版、逐版本安装、设置兼容性版本等关键操作,解决升级过程中可能遇到的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Mac启动mongo的问题


题主在Mac上启用mongodb遇到很多麻烦,查阅了很多资料,终于把问题解决了,在这里整理一下,分享一下。

  1. Question1:Error while upgrading Mongodb from 3.2 to 3.6
    在安装mongodb 4.X 版本前要先升级到3.6
    Solution:
    - 先卸载mongodb
    - 再一个版本一个版本的安装
Uninstall your current mongodb

brew uninstall mongodb
Install mongodb 3.2 version

brew install mongodb@3.2
Start mongod 3.2 version (when you install the old version like above, you need the full path to run it.)

/usr/local/opt/mongodb@3.2/bin/mongod
Start mongo 3.2 version

/usr/local/opt/mongodb@3.2/bin/mongo
Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.2" } )
Quit

>quit();
Terminate the mongod

Find PID of mongod process using $ top

Kill the process by $ kill <PID> (the Mongo docs have more info on this)
Uninstall mongodb 3.2

brew uninstall mongodb@3.2
Repeat the above steps for 3.4

Install mongodb 3.4 version

brew install mongodb@3.4
Start mongod 3.4 version

/usr/local/opt/mongodb@3.4/bin/mongod
Start mongo 3.4 version

/usr/local/opt/mongodb@3.4/bin/mongo
Run the important command

> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
...

Repeat the above steps for mongodb 3.6

...

Last, after uninstall 3.6, then you can install the most current version, 4.x, you don't have to specify the @4.x etc., just

Install the most current version

brew install mongodb
  1. Question2:Error: File exists @ dir_s_mkdir - /Users/Library/LaunchAgents
    Solution:rm ~/Library/LaunchAgents
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值