在OSX上安装和运行MongoDB

编程入门 行业动态 更新时间:2024-10-28 16:28:36
本文介绍了在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.

  • 为您的mongo服务器启动一个终端
  • 转到 mongodb-install-directory> / bin 目录
  • 运行命令

  • Start a terminal for your mongo server
  • Go to <mongodb-install-directory>/bin directory
  • 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

    本文发布于:2023-10-20 01:00:50,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1509358.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:OSX   MongoDB

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!