win7 64位 mongodb2.6.0 安装服务启动

Workaround to install as a service

You can manually install 2.6.0 as a service on Windows from an Administrator cmd prompt.

Assuming you have installed MongoDB using the MSI installer, the default path will be C:\Program Files\MongoDB 2.6 Standard. If you have installed in an alternative directory you will need to adjust the paths as appropriate.

Steps to install:

1) Open an Administrator command prompt

  • Windows 7 / Vista / Server 2008 (and R2)
    • Press Win + R, then type "cmd", then press Ctrl + Shift + Enter.
  • Windows 8 / 8.1
    • Press Win + X, then press A.

2. Make directories for your database and log files

mkdir c:\data\db
mkdir c:\data\log

3. Create a configuration file. This file can include any of the configuration options for mongod, but at a minimum must include a valid setting for logpath:

echo logpath=c:\data\log\mongod.log> "C:\Program Files\MongoDB 2.6 Standard\mongod.cfg"
echo dbpath=c:\data\db>> "C:\Program Files\MongoDB 2.6 Standard\mongod.cfg"

4. Create the MongoDB service

sc create MongoDB binPath= "\"C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe\" --service --config=\"C:\Program Files\MongoDB 2.6 Standard\mongod.cfg\"" DisplayName= "MongoDB 2.6 Standard" start= "auto"

Note that sc requires a space between "=" and the configuration values (eg "binPath= "), and a "\" to escape double quotes.

If this works you should see:

[SC] CreateService SUCCESS

5. Start the MongoDB service:

net start MongoDB

If successful you should be able to connect using the mongo shell. If the service did not start successfully, the log file should contain information to help you troubleshoot.

see more information.

 

posted @   无赖君子  阅读(1431)  评论(4编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示