Installation mongodb-window10 version

First, download mongodb

Official address: https: //www.mongodb.com/

 

 

 

 The second step installation mongodb

Run mongodb-win32-x86_64-2008plus-ssl-v3.4-latest-signed.msi

 

 

 

 The third step. Start MongoDB

Creating several folders as follows: database path (data directory), log path (logs directory) and log files (mongo.log file)

 Create a profile mongo.conf, document reads as follows:

# Database path
dbpath=J:\Tool\mongDB\Server\3.4\data
# Log output file path
logpath=J:\Tool\mongDB\Server\3.4\logs\mongo.log
# Error logs are append mode
logappend=true
# Enable log file is enabled by default
journal=true
# This option can filter out some useless log information, if necessary debug set to false
quiet=true
The default port number is 27017 #
port=27017

 Install MongoDB service

 Execute cmd command in this path

mongod.exe --dbpath "J:\Tool\mongDB\Server\3.4\data" --logpath "J:\Tool\mongDB\Server\3.4\logs\mongo.log" --install --serviceName "mongo" --logappend --directoryperdb

如果出现:途中错误

 在C:\Windows\System32路径下执行以管理员的身份执行命令

 然后再执行上面的命令,如下图所示,MongoDB服务安装成功

执行完之后就去启动服务,如果启动服务,出现以下异常 window不能再本地计算机启动MongoDB

解决办法:

1.删除文件

J:\Tool\mongDB\Server\3.4\data下的mongod.lock和storage.bson文件

 2.删除服务

mongod.exe --logpath "J:\Tool\mongDB\Server\3.4\logs\mongo.log" --logappend --dbpath "J:\Tool\mongDB\Server\3.4\data" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --remove
3.重新安装服务

mongod.exe --logpath "J:\Tool\mongDB\Server\3.4\logs\mongo.log" --logappend --dbpath "J:\Tool\mongDB\Server\3.4\data" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install

 4.结果

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/cxyyh/p/11993114.html