Net start MongoDB - system error 2 - mongodb

I've just downloaded mongodb 3.2 version and went through the installtion using mongodb manual.
My mongodb directory is in c:\mongodb\.
When I try to run net start MongoDB command using cmd in superuser mode
it says :
system error 2 has occurred.
the system cannot find the file specified.

Try to remove mongoDB as a service first before installing it again if you are not using MongoDB for the first time.
mongod --remove
then install mongoDB service again in your own mongoDB folder.
mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --rest --install

Related

How to start Mongo DB server from Windows?

I have installed MongoDB 3.6.3 on my Window 8.1(64 bit) machine. I have created the path data/db too but when I tried to start mongodb using the command 'C:\Program Files\MongoDB\Server\3.6\bin', it is not starting. It showing a message "the program can't start because api-ms-win-crt-convert-l1-1-0.dll is missing from your computer". Anyone help me to start Mongo DB server. Thanks in advance.
Open CMD
nevigate to C:\Program Files\MongoDB\Server\3.6\bin [Your mongodb installed location]
Then run command as mongod --dbpath E:\sangram\mongo_workspace --port 27017
[E:\sangram\mongo_workspace] is my local directory where i'll store my mongodb data

Changing MongoDB 3.6 default db path in Windows

I just installed a new MongoDB 3.6 on my Windows machine. Now I'm trying to change the default DB path. So I tried this:
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
It worked, but only until I restarted Mongo. Then it was back to usual c:\data\db.
I tried to google it, saw some info about changing a mongod.conf file, but I can't find this file in my installation.
Any suggestions?
Save this script in a Batch File(Mongo.bat) and run it every time:
"C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
You need to start mongod with same command everytime:
C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe" --dbpath c:\mongodb\data
Or you can create a configuration file and install mongo as a service.
.

Start MongoDB in cmd on windows 10

I Want to install MongoDB and start it,I used this codes in cmd
mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo,log --logappend --rest --install
And For start this used this code in cmd net start MongoDB But I give this Error
The service name is invalid.
More help is available by typing NET HELPMSG 2185.
How I Can fixed it?I'm searching any more time But don't find any Solution
The problem is, the MongoDB service isn't installed, because you executed the install command without admin privilegues.
To solve this, open the start menu, enter powershell, right-click and select run as administrator. Now you should be able to run the install command.
mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --rest --install
If you encounter the error again, after you tried to install the service as an admin user, you should have a look at the log file (in your case C:\mongodb\log\mongo.log)
Btw. there was an typo in your command for the logfile name (command instead of point for the filename)

Error while installing MongoDB as windows service

I tried installing MongoDB 3. X version as windows service. I executed following commands:
mkdir c:\data\db
mkdir c:\data\log
echo logpath=c:\data\log\mongod.log> "C:\mongodb\mongod.cfg"
echo dbpath=c:\data\db>> "C:\mongodb\mongod.cfg"
sc.exe create MongoDB binPath= "\"C:\mongodb\bin\mongod.exe\" --service --config=\"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
after executing these commands I got following message:
[SC] CreateService SUCCESS
But I was unable to start the windows service. Everytime, I tried installing MongoDB as windows service, it threw some error.
Then I followed this post: but I am still getting errors.
Please see below image for more information.
Event log under System is showing following error: The MongoDB service terminated with service-specific error Cannot create another system semaphore..
Earlier I had installed MongoDB v 2.6 & I was able to install it successfully as windows service. I wonder if I need a different approach to install version 3.X.
I have now installed mongodb 2.6. and followed these instructions.
I suggest extracting the Mongo installation to c:\mongodb.
Create the c:\mongodb\logs and the c:\mongodb\data\db directories.
Then browse the the c:\mongodb\bin directory and run the following to remove the service (if you've installed it!):
mongod --remove
Then install the service, specifying the log and data directories:
mongod --logpath c:\mongodb\logs\mongo.log --dbpath c:\mongodb\data\db --directoryperdb --install
I resolved this by removing mongod.lock and storage.bson files under /data/db.

Mac Installing Mongodb

I used brew to installed the mongoDB. Created the database and permission.
Suns-MacBook-Pro:~ Dawn$ mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
Suns-MacBook-Pro:~ Dawn$ mongo
MongoDB shell version: 2.2.2
connecting to: test
It keeps connecting after 5 minutes. Any suggestions what problem here
I would use the --dbpath to set the data directory.
Example: mongod --dbpath /var/mongodata
/var/mongodata should be created first.