Here is my mongod.cfg
file:
bind_ip = 127.0.0.1
dbpath = C:mongodbdatadb
logpath = C:mongodblogmongo-server.log
verbose=v
Here is my mongod
service command:
mongod -f c:mongodbmongod.cfg --install
I have installed MongoDB about a week ago and it all worked fine, however today when I ran mongo
command I got the following error:
Failed to connect to 127.0.0.1:27017,
reason: errno:10061 No connection could be made because the target machine actively refused it
How can I fix that? I use Windows 8.1
Solution:
I forgot to start mongodb service with this command:
net start mongodb
Improved solution:
1) Change directory to root drive C:
, and type the command below into an admin cmd
prompt window,
C:mongodbinmongod.exe --config c:mongodbmongod.cfg --install
2) Then type net start MongoDB
after which you should see the following message:
"The Mongo DB service was started successfully"
3) Then go to the control panel Start>Administrative Tools>Services
, scroll down to MongoDB in the list of services and change start up type to automatic, if you so desire. Press OK.
4) Finally type C:mongodbinmongo.exe
and you should be connected to the Mongo test DB.
Reference: https://www.youtube.com/watch?v=-mik4dPArCU
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…