MongoDB Installation on Windows Using ZIP File (No Installer) – Create Database, User & Password

MongoDB Installation on Windows: If you’re a developer looking to install MongoDB on Windows without using the MSI installer, you’re in the right place. This tutorial guides you through installing MongoDB using the ZIP archive, setting up a MongoDB database, and creating a user with a username and password. Ideal for beginners and professionals who want more control over their MongoDB setup!

MongoDB Installation on Windows Using ZIP File-min

Why Use the ZIP File Instead of the Installer?

Using the ZIP file lets you:

  • Install MongoDB without admin privileges
  • Portably run MongoDB from any folder
  • Configure MongoDB manually (great for learning!)

Step 1: Download the MongoDB ZIP File for Windows

  1. Visit the official MongoDB download page:
    👉 https://www.mongodb.com/try/download/community
  2. Select:
    • Version: Choose the latest stable version.
    • Platform: Windows
    • Package: ZIP
  3. Click Download.
MongoDB Installation on Windows

Step 2: Extract the ZIP File

  1. Extract the ZIP file to your desired directory.
    For example: C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9
  2. You’ll find a folder like:
    C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9\bin
MongoDB Installation on Windows

Step 3: Create Data and Log Directories

MongoDB needs a folder to store database files.

Open Command Prompt and run the following command to create the required directories:

run the following commands:
mkdir C:\Mongodb\database

mkdir C:\Mongodb\log

Once you execute the above Command, you can see the necessary folders have been created under the C:\Mongodb folder

Create Data and Log Directories

Step 4: Create a Configuration File (Optional but Recommended)

Create a file named mongod.cfg in C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9 With the following content:

mongod.cfg
systemLog:
  destination: file
  path: C:\Mongodb\log\mongod.log
  logAppend: true
storage:
  dbPath: C:\Mongodb\database
net:
  bindIp: 127.0.0.1
  port: 27017
security:
  authorization: enabled

Step 5: Start the MongoDB Server

Open Command Prompt and navigate to the MongoDB bin folder:

run the following commands:
cd C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9\bin

mongod --config "C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9\mongod.cfg"
Start the MongoDB Server

Now, leave this window open to keep the MongoDB server running.

Step 6: Download the MongoDB Shell ZIP File

  1. Visit the official MongoDB Shell download page:
    👉 https://www.mongodb.com/try/download/shell
  2. Select:
    • Version: Choose the latest version.
    • Platform: Windows
    • Package: ZIP
  3. Click Download.
Download the MongoDB Shell ZIP File

Step 7: Extract the MongoDB Shell ZIP File

  1. Extract the ZIP file to your desired directory.
    For example: C:\Mongodb\mongosh-2.5.1-win32-x64
  2. You’ll find a folder like the image below:
Download the MongoDB Shell ZIP File

Step 8: Open a New Command Prompt and Start the Mongo Shell

Open another Command Prompt and run the following command:

run the following commands:
cd C:\Mongodb\mongosh-2.5.1-win32-x64\bin

mongosh
mongodb shell start min

You’re now inside the MongoDB shell.

Step 9: Create a MongoDB Database, Username, and Password

Switch to a new database (eg: test_db), run the following command:

command
use test_db

Create a new database using the following command:

command
db.sample.insertOne({"name":"test_db"})

To see the created database, run the following command:

command
show dbs

Now, let’s create a new user (test_user) with a security password (test_user):

command
db.createUser({user: "test_user",pwd: "test_user",roles: [ { role: "readWrite", db: "test_db" }]})
Create a MongoDB Database, Username, and Password

Step 10: Test Login with Authentication

Exit the shell and Reconnect using the created credentials:

run the following commands:
exit

mongosh test_db -u test_user -p test_user
Test Login with Authentication

If login is successful, you’re ready to manage your secured MongoDB instance!

Optional: Add MongoDB to System PATH

To run MongoDB commands from any terminal:

  1. Search “Environment Variables” in Windows.
  2. Edit System Variables → Find Path.
  3. Add: C:\Mongodb\mongodb-win32-x86_64-windows-8.0.9\bin
  4. Click OK.
Add MongoDB to System PATH
Add MongoDB to System PATH

Now you can run mongod from anywhere.

Conclusion

You’ve successfully installed MongoDB on Windows using the ZIP file, created a database, and added a user with a username and password. This method gives you greater control and understanding of how MongoDB works under the hood.

You may want to see: MongoDB MCQs Multiple-Choice Questions and Answers

Share with friends

Leave a Comment

Your email address will not be published. Required fields are marked *