Create a file called mongod.cfg in MongoDB folder if you dont have it. In my case: C:\Users\ivanbtrujillo\MongoDB

Then, edit mongod.cfg with notepad and add a line with the following (our custom dbpath):

dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db

In this file you should especify the logpath too. My mongod.cfg file is:

logpath=C:\Users\ivanbtrujillo\MongoDB\log\mongo.log
dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db

If you uses mongoDB as a windows service, you have to change this key and especify the mongod.cfg file.

To install mongodb as a windows service run this command:

**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" –install**

Open regedit.exe and go to the following route:

HKEYLOCALMACHINE\SYSTEM\CurrentControlSet\services\MongoDB

MongoDB service does not work, we have to edit the ImagePath key, delete its content and put the following:

**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg"
--logpath="C:\Users\ivanbtrujillo\MongoDB\log\mongo.log" –service**

We indicates to mongo it's config file and its logpath.

Then when you init the mongodb service, it works.

Here is a full tutorial to install mongoDB in windows:http://ivanbtrujillo.herokuapp.com/2014/07/24/installing-mongodb-as-a-service-windows/

修改MongoDb的 DB 和 Log 存储路径 (Windows)-摘自网络的更多相关文章

  1. maven 配置: 修改默认的 .m2仓库 默认存储路径.

    maven 配置: 修改默认的 .m2仓库 默认存储路径. 一 .在系统maven里修改 1.在maven_HOME/conf/下找到配置文档 settings.xml 在文档中添加如下的配置说明 & ...

  2. Android中的GreenDao框架修改数据库的存储路径

    目前android中比较热门的数据库框架有greenDAO.OrmLite.AndrORM,其中我比较喜欢用GreenDao,其运行效率最高,内存消耗最少,性能最佳.具体怎么使用GreenDao,网上 ...

  3. 修改mysql数据库存储路径

    最近一段比较忙,所以一直没有及时的更新总结一下测试路上遇到的问题,今天先来分享一下如何修改mysql存储路径(场景:在自己电脑上搭建的服务器上安装mysql,二.在公司自己的服务器上搭建mysql数据 ...

  4. Sqlserver数据库存储路径的修改

    Sqlserver数据库存储路径的修改 Sqlserver数据库存储路径问题:本系统sqlserver路径默认是存储在C盘目录下的,由于数据会慢慢变大和避免重装系统数据丢失等问题,最好手动将路径设置在 ...

  5. oracle 修改表空间存储路径

    [root@yoon ~]# more /etc/oracle-releaseOracle Linux Server release 5.7 Oracle Database 11g Enterpris ...

  6. 修改VirtualBox虚拟机默认存储路径及虚拟机迁移方法

    修改默认安装路径 在安装完虚拟机以后发现我的虚拟的磁盘文件是放在C盘的,就想着有没有办法修改默认存储路径.后来发现确实可以修改,修改虚拟机方法如下:"管理"--->" ...

  7. ubuntu16.04 Docker默认存储路径修改

    Ubuntu 16.04 Docker默认存储路径修改

  8. Docker 修改存储路径

    Docker 版本 1.13 及以下 systemctl stop docker.service cp /usr/lib/systemd/system/docker.service /home/doc ...

  9. Docker 修改默认存储路径的一个方法

    1. 前期安装创建centOS的虚拟机时发现自己对linux的挂载点不清楚, 造成挂载点的分配不太均匀,如图: root / 节点的大小设置的比较小 /home路径设置的一直比较大 但是docker ...

随机推荐

  1. Java集合框架学习笔记

    集合类的由来:对象用于封装特有数据,对象多了需要存储,如果对象的长度不确定,就使用集合存储. 集合特点1.用于存储对象的容器.2.集合的长度可变.3.集合中不可以存储基本类型 集合容器因为内部的数据结 ...

  2. IOSTimer的例子留个备注

    1.创建一个定时器 ,以下是便利构造器方法,+ scheduledTimerWithTimeInterval:invocation:repeats:+ scheduledTimerWithTimeIn ...

  3. 转:Cache相关

    声明:本文截取自http://blog.163.com/ac_victory/blog/static/1033187262010325113928577/ (1)“Cache”是什么 Cache(即高 ...

  4. 启动PL/SQL Developer 报字符编码不一致错误 Database character set (AL32UTF8) and Client character set (ZHS16GBK) are different. Character set conversion may cause unexpected results. Note: you can set the client

    今天写hibernate时候遇到一些异常 代码: 出现异常情况: 出现以上原因是Session关闭 如果不是使用的SessionFactory.getSession()来获得Session. 而是使用 ...

  5. Python3 学习第三弹:异常情况如何处理?

    python 的处理错误的方式: 1> 断言 assert condition 相当于 if not condition: crash program 断言设置的目的就是因为与其让程序晚点崩溃, ...

  6. Asp.Net Unix时间戳和DateTime类型转换

    using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System. ...

  7. codevs 1106 篝火晚会

    不要问我为什么WA这么多次... #include<iostream> #include<cstdio> #include<cstring> #include< ...

  8. HDU 5312 Sequence (规律题)

    题意: 一个序列的第n项为3*n*(n-1)+1,而 n>=1,现在给一个正整数m,问其最少由多少个序列中的数组成? 思路: 首先,序列第1项是1,所以任何数都能构成了.但是最少应该是多少?对式 ...

  9. json转csv

    import re # csv格式 # 'k1,k2,k3\nv1,v2,v3\nv4,v5,v6\n' market_list_data = { "data": [ { &quo ...

  10. webview javascript 注入方法

    Android中向webview注入js代码可以通过webview.loadUrl("javascript:xxx")来实现,然后就会执行javascript后面的代码. 但是当需 ...