I was trying to run MongoDB:
E:\\mongo\\bin>mongod
mongod --help for help and startup options
Sun Nov 06 18:48:37
Sun Nov 06 18:48:37 warning:
This worked for me (if it applies that you also see the lock file):
first>youridhere@ubuntu:/var/lib/mongodb$ sudo service mongodb start
then >youridhere@ubuntu:/var/lib/mongodb$ sudo rm mongod.lock*
Create the data/db directory in your main (windows) partition:
C:\> mkdir \data
C:\> mkdir \data\db
and then go to your mongo_directory/bin and run mongod.exe:
C:\> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongod
DON't CLOSE THIS WINDOW
Now in a different command prompt window run Mongo:
C:\> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongo
(REMEMBER YOU HAVE TO KEEP THAT OTHER WINDOW OPEN)
This solved the problem for me.
You just need to create directory in C:. as C:\data\db\
Now just start mongoDB:
C:\Users\gi.gupta>"c:\Program Files\MongoDB\Server\3.2\bin\mongod.exe"
2016-05-03T10:49:30.412+0530 I CONTROL [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] MongoDB starting : pid=7904 port=27017 dbpath=C:\data\db\ 64-bit host=GLTPM-W036
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] db version v3.2.6
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] git version: 05552b562c7a0b3143a729aaa0838e558dc49b25
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] allocator: tcmalloc
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] modules: none
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] build environment:
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] distmod: 2008plus-ssl
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] distarch: x86_64
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] target_arch: x86_64
2016-05-03T10:49:30.414+0530 I CONTROL [initandlisten] options: {}
2016-05-03T10:49:30.427+0530 I - [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to
2016-05-03T10:49:30.429+0530 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(f
chive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-05-03T10:49:30.998+0530 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-05-03T10:49:30.998+0530 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/data/db/diagnostic.data'
2016-05-03T10:49:31.000+0530 I NETWORK [initandlisten] waiting for connections on port 27017
2016-05-03T10:49:40.766+0530 I NETWORK [initandlisten] connection accepted from 127.0.0.1:57504 #1 (1 connection now open)
It will then run as service in background.
create folder structure data/db in the working directory and then starting up mongodb using "mongod --dbpath data/db" works just fine
After several attempts this works for me on Windows 7 env.:
Initially directory to which you have copied all MongDB sources has such view:
bsondump.exe
mongo.exe
mongod.exe
mongod.pdb
mongodump.exe
mongoexport.exe
mongofiles.exe
mongoimport.exe
mongooplog.exe
mongoperf.exe
mongorestore.exe
mongos.exe
mongos.pdb
mongostat.exe
mongotop.exe
All you need is to add data directory and db directory nested( data/db ) Final view should look like this:
data
bsondump.exe
mongo.exe
mongod.exe
mongod.pdb
mongodump.exe
mongoexport.exe
mongofiles.exe
mongoimport.exe
mongooplog.exe
mongoperf.exe
mongorestore.exe
mongos.exe
mongos.pdb
mongostat.exe
mongotop.exe
Than simply type in directory where MongoDB sources and data/db dirs exist this command:
C:\my_mongo_dir\bin>mongod --dbpath .\data\db
The very simplest approach given by mongo README help file
RUNNING
For command line options invoke:
$ ./mongod --help
To run a single server database:
$ sudo mkdir -p /data/db
$ ./mongod
$
$ # The mongo javascript shell connects to localhost and test database by default:
$ ./mongo
> help
If you are working with windows, go to your directory where you have mongo.exe
use the following commands, (I am sharing mine)
C:\Program Files\MongoDB\Server\3.6\bin>mkdir \data
C:\Program Files\MongoDB\Server\3.6\bin>mkdir \data\db
C:\Program Files\MongoDB\Server\3.6\bin>mongod ## this will start your mongoDB server
Now you need to run another CMD prompt and go to the directory where you have mongo and just run it
C:\Program Files\MongoDB\Server\3.6\bin>mongo ## this will start your mongoDB client
Hope it helped :)
If it doesn't work, run CMD as an administrator