https://www.mongodb.com/download-center#community
website to download mongodb installation (custom installation, remove the check mark – Install Mongodb Compass)
4.2.3
First create a folder under the D drive of the server (prerequisite D:\log)
D:\data\db
Then enter the bin directory of mongodb. According to the installation path, I am here D:\mongodb\bin.
First open a command line window and execute the following statement
mongod.exe --dbpath D:\mongodb\data\db
There will be a line showing waiting for connections on port 27017, indicating that the startup is successful, do not close the window yet
. Open a cmd window in the current directory to execute the command
mongo.exe
The version number of mongodb will be displayed, which means it is no problem
Configure services and set up remote connections
Next, we have to configure the mongodb service to make the server a mongodb server. In
this step, if you can find mongod.cfg in your mongodb directory , you can directly modify bindIp, otherwise create a text file in the mongodb bin directory , And named mongod.cfg, pay attention to indentation to use 4 spaces
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: D:\mongodb\data
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: D:\mongodb\log\mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
#mp:
Then execute the following command in the bin directory as an administrator to make the configuration effective
mongod.exe --config "D:\mongodb\bin\mongod.cfg" --install
In this way, you can use commands to manage mongodb and start on boot
The next two commands are very important and must be executed
关闭mongodb net stop mongodb
开启mongodb net start mongodb
0.0.0.0 is set to allow remote access.
Reference blog https://blog.csdn.net/qq_40456064/article/details/90405156