Reputation: 4441
I'm newbie about node.js and mongodb.
I have already installed mongodb, but I can't connect to mongodb.
This is my error:
Huys-MacBook-Pro:~ huy$ mongo
MongoDB shell version: 2.0.2
connecting to: test
Tue Jan 3 17:12:01 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
Upvotes: 6
Views: 25599
Reputation: 33
Replace the /var/lib/mongodb with your dbpath
sudo rm /var/lib/mongodb/mongod.lock sudo mongod --dbpath /var/lib/mongodb/ --repair sudo mongod --dbpath /var/lib/mongodb/ --journal
Upvotes: 0
Reputation: 139
This worked for me:
2015-08-29T11:38:18.009-0700 I NETWORK [initandlisten] waiting for connections on port 27017
Upvotes: -1
Reputation: 83
I also ran into this issue today. Mongo had been working fine up until this point. In case you try sudo service mongodb start
and you find out the process is already running (start/running, process xxxx
). The solution is:
Delete the lock file
sudo rm /var/lib/mongodb/mongod.lock
and restart service again
sudo service mongodb start
Upvotes: 6
Reputation: 1
I had same problem. Yesterday was working perfectly mongo on my mac, but today doesn't, I solved just typing in a terminal command.
brew update
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
Upvotes: 0
Reputation: 1462
I had the same problem under xubuntu, had been using mongo for quite long, for some reason it could not start anymore reporting that very same error... in case anyone is in the same situation, the solution for me was to reinstall:
apt-get autoremove mongodb
apt-get install mongodb-server
Upvotes: 1
Reputation: 4345
First of all, check that your data folder exists : mongo on Win. That is
C:\> mkdir \data
C:\> mkdir \data\db
Upvotes: 2
Reputation: 63683
MongoDB is not running, and I have a wild guess that your mistake is this one: Trouble installing mongodb using Homebrew
Create the path /data/db
and then try to start MongoDB again. (run mongod
)
Upvotes: 7
Reputation: 54050
if you are using windows version then
first run mongod
in one cmd
box
C:\> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongod
leave it open and now again tyep cmd
and do the below
:\> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin> mongo
Upvotes: 1
Reputation: 18219
It seems that mongod
is not running. Try to run mongod
from your console
see http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo for full document
Upvotes: 0