Mongodb uses Mongo to report error: could’t connect to server 127.0.0.1:27017, connection attempt failed: socket

Mongodb uses Mongo to report an error:

connecting to: mongodb://127.0.0.1 :27017/?compressors=disabled&gssapiServiceName=mongodb
2019-07-18T15:02:35.529+0800 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: ����Ŀ�����������ܾ����޷����ӡ� :
connect@src/mongo/shell/mongo.js : 342:17
there is a connection error when you enter Mongo on the command line

Solution:

Enter in the command line mongod.exe --dbpath E:\MongoDB\data\db

Among them, e:
do not close the CMD window, open a new CMD window again, and enter the Mongo command:

to open mongodb

Read More: