尝试连接到 mongodb 服务器时无法识别 mongod 命令 [英] mongod command not recognized when trying to connect to a mongodb server

查看:182
本文介绍了尝试连接到 mongodb 服务器时无法识别 mongod 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 docs.mongodb.org 上的教程,我已经完成了在 Windows 机器上安装 mongodb 的第一个教程.我现在处于 mongodb 开发入门的第二阶段.我被困在本节的第一阶段,它指示我在系统提示中键入mongo".当我这样做时,我只是收到一条错误消息,指出以下 'mongo' 不是内部或外部命令,也不是可运行的程序或批处理文件.我知道这可能是我做错的很简单的事情,有人有任何想法吗?

I am following the tutorials at docs.mongodb.org, I have completed the first tutorial which was to install mongodb on a windows machine. I am now at the second stage which is getting started with mongodb development. I am stuck at the first stage of this section which instructs me to type "mongo" into a system prompt. When I do this I simply get an error message saying the following 'mongo' is not recognized as an internal or external command, operable program or batch file. I know this is probably something quite simple that I am doing wrong, does anyone have any ideas?

推荐答案

您需要先在一个 cmd 窗口中运行 mongod,然后再打开另一个窗口并输入 mongo.确保你也更新了你的 Windows Path 环境变量,这样你就不必导航到所有 mongo 二进制文件所在的目录来启动应用程序.更新 Path 变量:

You need to run mongod first in one cmd window then open another and type mongo. Make sure you updated your Windows Path environment variable too so that you don't have to navigate to the directory you have all of the mongo binaries in to start the application. To update the Path variable:

转到控制面板 > 系统 &安全 > 系统 > 高级系统设置 > 环境变量 > 导航到路径变量点击编辑并将 ;C:\mongodb 添加到路径(或 MongoDB 所在的任何目录名称(半冒号分隔每个目录).

Go to Control Panel > System & Security > System > Advanced System Settings > Environment Variables > navigate to the Path variable hit Edit and add ;C:\mongodb to the Path (or whatever the directory name is where MongoDB is located (the semi-colon delimits each directory).

这篇关于尝试连接到 mongodb 服务器时无法识别 mongod 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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