在OSX上安装和运行MongoDB [英] Installing and Running MongoDB on OSX

查看:148
本文介绍了在OSX上安装和运行MongoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人可以在这里提供一些见解,我将非常感谢。

If someone can provide some insights here I would GREATLY appreciate it.

我是MongoDB的新用户,并且是(相对)新的命令行。

I am new to MongoDB, and (relatively) new to the command line.

我有一个express / node.js应用程序在MongoDB本地成功运行,但重新启动我的计算机后,我试图重新启动Mongo服务器,它开始给错误和开始。从那时起,我重新安装了Mongo几次才发现相同的错误。这是我收到的:

I had a express/node.js app running on MongoDB locally successfully, but upon restarting my computer, I attempted to restart the Mongo server and it began giving errors and wouldn't start. Since then, I have re-installed Mongo several times only to find the same error occurring. this is what I am receiving:

privee:mongodb-osx-x86_64-2.4.6 jonlinton$ ./bin/mongo
MongoDB shell version: 2.4.6
connecting to: test
Mon Aug 26 14:48:47.168 Error: couldn't connect to server 127.0.0.1:27017 at     src/mongo/shell/mongo.js:145
exception: connect failed

我缺少一个步骤吗?我应该创建一个配置文件吗?一些基本的指导将是非常有帮助的。预先感谢任何见解。

Am I missing a step? Should I be creating a config file? Some basic guidance would be really helpful. Thanks in advance for any insights.

推荐答案

假设您在安装后已经在bin下创建了data / db目录。

Assuming you have created the data/db directory under bin after install.


  1. 为您的mongo服务器启动一个终端

  2. 转到 mongodb-install-directory> / bin 目录

  3. 运行命令

  1. Start a terminal for your mongo server
  2. Go to <mongodb-install-directory>/bin directory
  3. Run the command

./ mongod

./mongod

为您的mongo shell启动一个终端

Start a terminal for your mongo shell

运行命令(确保输入数据库的名称)

Run the command (make sure you put the name of the database)

./ mongo test

./mongo test

这篇关于在OSX上安装和运行MongoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆