用brew安装mongodb过程中老是失败,琢磨了好久终于找到解决方案,亲测有效哦。下面是本人的解决过程讲解
问题总结:
无法连接到网站 homebrew.bintray.com,下载不了所需的压缩包
截取代码如下:
curl: (6) Could not resolve host: homebrew.bintray.com
Error: Failed to download resource "openssl"
Download failed: https://homebrew.bintray.com/bottles/openssl-1.0.2k.el_capitan.bottle.tar.gz
执行brew install mongodb 安装mongodb老是不成功,出现下面几个问题。
下面是问题截图

上面的问题主要是不能下载到软件压缩包
解决方法:
查找到brew 安装下载的缓存区
$ brew --cache
/Users/joyan/Library/Caches/Homebrew
复制上面下载失败的带‘.tar.gz’的链接在浏览器中打开会下载该压缩文件,然后把下载的压缩包放到 ‘/Users/joyan/Library/Caches/Homebrew’,
当所有的压缩包都下载完之后,再重新安装mongodb就会成功。
例如:在浏览器输入链接:https://homebrew.bintray.com/bottles/openssl-1.0.2k.el_capitan.bottle.tar.gz
在浏览器输入链接下载(如下图片):

下载的压缩包放到 ‘/Users/joyan/Library/Caches/Homebrew’(目录是根据 brew --cache找到的目录)

重新执行 ‘brew install mongodb’安装mongodb,就可以成功啦。。。。好感动~~( 如下图)

接下来启功数据库服务器:
$ brew services start mongodb
或者
$ mongod --config /usr/local/etc/mongod.conf
然后执行
$ mongo
看到有有箭头 > 就可以进入数据库操作啦
> show databases
admin 0.000GB
local 0.000GB
>
网友评论