Error in establishing database link after mongodb 3.4 installation

  mongodb, question

Problem scenario description

It is normal for me to type mongod -version at the command line after I install the ubantu apt source on mongodb's website:


I independently set up a data folder to store my project, with the following structure:
 I type mongod-dbpath ~/pile _ db/data-logpath ~/pile _ db/log/mongo.log-logappend-fork at the command line.
 Data directory and log log location are specified.  At this time, the mongod service in the system is already on.

At this time, the system reported an error:

I look at the records in the log/mongo.log file:
Said it was occupied by, but I didn’t set up any other mongo library. .
Mongo is not connected to the data I set myself.

On the contrary, the command line enters mongo at this time.
But this entry is not the data of pile_db that I pointed to.

I don’t know how to do it. Please give me some advice. I just got in touch with mongo. I think the other tutorials are all smoothly connected. I am a little embarrassed.

If I remember correctly, Ubuntu may have started a MongoDB database after installing MongoDB.

You check the method of mongodb start-stop service under Ubuntu. If you remember correctly, Service MongoDB Start/Stop/Restart.

Or you can replace MongoDB that you started separately with a port number.

Love MongoDB! Have Fun!