The mongoDB service failed to start (exception: connect failed)

[root@localhost bin]# ./mongo
MongoDB shell version v3.4.5
connecting to: mongodb://127.0.0.1:27017
2017-11-20T11:10:49.895+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1                                                                                        :27017, in(checking socket for error after poll), reason: Connection refused
2017-11-20T11:10:49.896+0800 E QUERY    [thread1] Error: couldn't connect to ser                                                                                        ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

The reason is that the database location is not specified

 ./mongod --dbpath /data/db

If your database directory is not /data/db, you can use the -dbpath to specify

. Start service

join

Read More: