简体   繁体   English

安装MongoDB时遇到问题

[英]Having trouble installing MongoDB

I am trying to set up MongoDB on my local machine. 我正在尝试在本地计算机上设置MongoDB。 I have attached some screenshots below. 我在下面附上了一些截图。 So I can run some of the MongoDB executable files from my terminal, but after I run ./mongod I can't call mongo as a command in the terminal. 因此,我可以从终端运行一些MongoDB可执行文件,但是运行./mongod之后,我无法在终端中将mongo作为命令来调用。 The commands git and node both work, but when I use the command mongo I get nothing. git和node命令都可以使用,但是当我使用mongo命令时却什么也没得到。

I have the mongoDB folder with everything in it on my desktop right now and I am pretty sure that is not where it needs to be. 我现在在桌面上拥有mongoDB文件夹,其中包含所有内容,我很确定那不是需要的位置。 Can anyone shed some light on the issues I might be having. 任何人都可以阐明我可能遇到的问题。

As a side note, I have MAMP installed on my localhost. 附带说明,我在本地主机上安装了MAMP。 Not sure if that is causing issues. 不知道这是否引起问题。

http://i.stack.imgur.com/X1bq8.jpg http://i.stack.imgur.com/X1bq8.jpg

http://i.stack.imgur.com/sJI83.jpg http://i.stack.imgur.com/sJI83.jpg

Since you downloaded MongoDB, not installed it from brew Mac OS does not understand that mongo should be in your app path and when you type: 由于您下载了MongoDB,因此未从brew Mac OS上安装MongoDB,因此无法理解mongo应该位于您的应用程序路径中以及在您键入以下内容时:

> mongo

It only searches your app path not your directory where the mongo binary actually is. 它仅搜索您的应用程序路径,而不搜索mongo二进制文件实际所在的目录。

You can install via homebrew, which is the recommended way: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ 您可以通过自制程序安装,这是推荐的方式: http : //docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/

You can also add that directory to your PATH like so: 您还可以将该目录添加到PATH中,如下所示:

export $PATH=$PATH:/path/to/mongo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM