MacOS Ventura v13.0.1下MongoDB服务启动失败求助
解决MacOS Ventura 13.0.1上MongoDB社区版6.0启动报错问题
修正启动命令拼写错误
你执行的启动命令存在拼写错误:brew services start mongodb-communit@6.0,缺少最后一个字母y,正确命令应为:
brew services start mongodb-community@6.0
清理旧的Launch Agent配置
报错指向用户目录下的plist文件,大概率是残留配置导致冲突:
- 停止残留服务进程:
brew services stop mongodb-community@6.0
- 删除用户目录下的错误plist文件:
rm ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
- 重新加载官方配置文件:
# 先卸载残留配置(若提示不存在可忽略) launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist # 加载brew安装的正确配置 launchctl load /usr/local/Cellar/mongodb-community@6.0/$(ls /usr/local/Cellar/mongodb-community@6.0)/homebrew.mxcl.mongodb-community.plist
检查MongoDB数据目录权限
MongoDB默认数据目录为/data/db,权限异常会导致启动失败:
- 创建数据目录(如果不存在):
sudo mkdir -p /data/db
- 设置正确的读写权限:
sudo chown -R $(whoami) /data/db sudo chmod -R 755 /data/db
手动启动排查具体错误
若上述操作无效,直接手动启动MongoDB查看详细错误日志,精准定位问题:
mongod --config /usr/local/etc/mongod.conf
终端会输出具体报错信息(比如端口占用、配置文件语法错误等),根据日志针对性修复即可。
重新启动服务
完成以上步骤后,用正确命令启动服务:
brew services start mongodb-community@6.0
执行brew services list检查状态,确认服务是否正常运行。
内容的提问来源于stack exchange,提问作者ls168
相关产品推荐
相关产品推荐

