当前位置:网站首页>Install and run mongodb under win10
Install and run mongodb under win10
2022-06-23 04:55:00 【mercenary's L】
Two 、 install
During installation , You can click "Custom( Customize )" Button to set your installation directory .


At this time, I will change the installation directory to D:\MongoDB
Next installation "install mongoDB compass" Don't check ( Of course, you can also choose to install it , It may take longer to install ),MongoDB Compass Is a graphical interface management tool , We can download and install it from the official website in the back , Download address :MongoDB Compass Download | MongoDB.

3、 ... and 、 Create a data directory
MongoDB Store data directory in db Under the table of contents . But this data directory will not be created actively , We need to create it after the installation , And then create the directory of database and log files .
1、 Create a data directory

2、 Create database and log files

Four 、 function MongoDB service 、 Connect MongoDB database .
Install well MongoDB After that, we first need to MongoDB The service has been improved , There are two ways to start a service .
1、 Start... From the command line MongoDB service
To run from the command prompt MongoDB The server , You have to go from MongoDB The directory bin Execute... In directory mongod.exe file .
D:\MongoDB\bin\mongod --dbpath d:\MongoDB\data\db
I am here powerShell The effect of execution in is as follows

Connect from the command line MongoDB To test
We can run it in a command window mongo.exe Command to connect MongoDB, Execute the following command :
D:\MongoDB\bin\mongo.exe I am here powerShell The effect of execution in is as follows , Connect to MongoDB Then we can enter db By default, the command view points to test database .

2、 Run by configuration MongoDB service
First step 、 Create a profile
Create a profile . The file must be set to systemLog.path Parameters , It's better to include some additional configuration options .
for example , Create a configuration file located in C:\MongoDB\mongod.cfg, It specifies systemLog.path and storage.dbPath. The specific configuration is as follows :

The second step 、 install MongoDB service
Through execution mongod.exe, Use --install Option to install the service , Use --config Option to specify the previously created configuration file .( During installation powershell You must run as an administrator or the installation will not succeed )
D:\MongoDB\bin\mongod.exe --config "D:\MongoDB\mongod.cfg" --install ps: Whether the installation is successful or not can be reached data\log\mongod.log In the file , If there is an error, you can also view the error reason here .
The third step 、 start-up MongoDB service ( This is the time powershell Also as an administrator )
net start MongoDB I am here powershell The results of the operation in are as follows , After successful startup, you can windows There will be... In the service MongoDB The service is already running .


Next we can run in the command window as above mongo.exe Command to connect MongoDB, Carry out connection test , Execute the following command :
D:\MongoDB\bin\mongo.exe My operation results are as follows :

Step four 、 close MongoDB service ( This is the time powershell Also as an administrator )
net stop MongoDB
remarks : The above two operations MongoDB Choose one of the methods , Create a with the second windows service , Don't hang it all the time powershell window .
边栏推荐
- 电流继电器JDL-1002A
- thinkphp6 模版替换
- Pta:7-58 Book audio-visual rental management
- Halcon knowledge: binocular_ Discrimination knowledge
- 如何更好地组织最小 WEB API 代码结构
- Pta:7-67 friend is very simple 2016final
- 20000 words + 20 pictures | details of nine data types and application scenarios of redis
- Dpr-34v/v two position relay
- Flask基础:环境搭建+配置+URL与试图之间的映射+重定向+数据库连接
- Kali 安装之腾讯云经验遇到坑
猜你喜欢
随机推荐
Abnova 荧光染料 510-M 链霉亲和素方案
Laravel customizes the paging style through the service provider
Common concepts and terms in offline warehouse modeling
2022 simulated examination question bank and answers for safety management personnel of metal and nonmetal mines (open pit mines)
32 single chip microcomputer has more than one variable Used in C
自举驱动、top开关电源、光耦拾遗
Abnova PSMA磁珠解决方案
DPR-34V/V双位置继电器
左值与右值
Usage of API interface test ------ post
Cocos learning diary 1 - node
FreeModBus解析1
TS advanced infer
Abnova actn4 purified rabbit polyclonal antibody instructions
free( )的一个理解(《C Primer Plus》的一个错误)
PaddlePaddle模型服务化部署,重新启动pipeline后出现报错,trt报错
Principle of 8-bit full adder
反编译
Openjudge noi 1.13 50: several
如何让社交媒体成为跨境电商驱动力?这款独立站工具不能错过!









