Installing and Configuring MongoDB on Windows
Required Software Version
The installation package used in this tutorial is:
mongodb-win32-x86_64-2008plus-ssl-3.4.4-signed.msi
Alternative version available:
mongodb-win32-x86_64-2008plus-3.4.24-signed.msi
Step-by-Step Installation Proces
1. MongoDB Installation Guide
- Execute the instaler file
mongodb-win32-x86_64-2008plus-ssl-3.4.4-signed.msiby double-clicking - Proceed by clicking "Next"
- Accept the license agreement to continue, then click "Next"
- Select the custom installation option instead of typical, followed by "Next"
- Specify your preferred installation directory. Example path:
D:\MongoDB\Server\3.4\ - Confirm your selected directory and proceed with "Next"
- Complete the installation by clicking "Install"
2. Post-Installation Configuration
- Navigate to your installation directory and copy the bin folder path:
D:\MongoDB\Server\3.4\bin - Add this path to your system's environment variables
- Create two directories under
D:\MongoDB:dataandlog, plus a configuration file namedmongodb.config - Within the
datafolder, create a subdirectory calleddb. Inside thelogfolder, create a file namedmongo.log - Configure the
mongodb.configfile with these entries:
logpath=D:\MongoDB\log\mongo.log
dbpath=D:\MongoDB\data\db
- Launch Command Prompt as Administrator (★Administrator privileges are mandatory)
- Execute the following command (adjust paths according to your setup):
mongod --dbpath D:\MongoDB\data\db
-
After the process completes, verify installation by accessing http://127.0.0.1:27017/ in your browser. A successful connection indicates MongoDB is running.
-
Install MongoDB as a Windows service. After stopping the current instance with Ctrl+C, run one of these commands:
mongod --config D:\MongoDB\mongodb.config --install
or
mongod --dbpath "D:\MongoDB\data\db" --logpath "D:\MongoDB\log\mongo.log" --install --serviceName "MongoDB"
Ensure all paths match your actual installation directories
Verify successful service installation by pressing Windows+R and typing services.msc to open the Services panel.
If services.msc doesn't work, try right-clicking on 'This PC' from desktop, select 'Manage', then navigate to Services and Applications > Services.
Daatbase Operation Commands
Starting the MongoDB Service
- From an administrator Command Prompt, execute:
net start MongoDB
- Alternatively, start the service through the Windows Services interface
- Access the database by entering:
mongo
Stopping the MongoDB Service
- Use Command Prompt (administrator mode) to execute:
net stop MongoDB
- Or stop through the Windows Services panel
Standard MongoDB operations can be found in additional documentation.