Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 373 Vote(s) - 3.4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MongoDB not working. "ERROR: dbpath (/data/db) does not exist."

#1
I'm getting the following error when I try to run "mongod" in the terminal. I've tried uninstalling, reinstalling, and restarting the machine. Any suggestions on how to get it working would be amazing.

ERROR:

dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See

[To see links please register here]



Side note:
Node also stopped working on my machine around the same time that I got this error.

events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]

Any help would be much appreciated!
Reply

#2
This should work to ensure that the directory is set up in the right place so that Mongo can find it:

``sudo mkdir -p /data/db/``

``sudo chown `id -u` /data/db``
Reply

#3
You need to create the directory on root /data/db or set any other path with the following command :

mongod --dbpath /srv/mongodb/

[See the example link][1]


[1]:

[To see links please register here]

Reply

#4
Change the user of the new data directory:

> chown mongodb [rute_directory]

And try another time to start the mongo service

> service mongod start

I solve the same problem with this.
Reply

#5
I solved the problem with :

`sudo mongod --dbpath=/var/lib/mongodb` and then mongo to access the mongodb Shell.
Reply

#6
Daemons (usually ending with d) are normally started as services. Starting the service (daemon) will allow mongodb to work as designed (without permission changes if integrates well with your distro). I start it using the service named mongodb instead of starting mongod directly--on distro with systemd enable on startup then run like:

sudo systemctl enable mongodb
sudo systemctl start mongodb

or, on distro with upstart (if you have /etc/init) or init (if you have /etc/init.d) ( [

[To see links please register here]

][1] ) instead run:

sudo service mongodb enable
sudo service mongodb start


If you have a distro with rc ("run commands") such as Gentoo (settings in /etc/init.d) ([

[To see links please register here]

][2]) run:

rc-update add mongodb default
/etc/init.d/mongodb start

In a distro/version of FreeBSD which still has rc (check whether your version switched to systemd, otherwise see below):

- add the following line to /etc/rc.conf:

mongod_enable="YES"

- then:

`sudo service mongod start`

After starting the service, an unpriveleged user can use mongo, and each user will have separate data.

[1]:

[To see links please register here]

[2]:

[To see links please register here]

Reply

#7
I also got the error that "The file /data/db doesn't exist" when I tried to save my file using the "mkdir -p /data/db" command(using both with and without sudo command). But later on one site, a person named Emil answered that the path "/data/db" no longer works on Mac, so use "~/data/db" instead
i.e., use the command
mkdir -p ~/data/db
instead of previous command.
Moreover, use
mongod --dbpath ~/data/db
to run mongod
It worked for me, hope it work for others too facing the same problem
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through