How to start Mongo DB from Windows?

I installed MongoDB on my computer with Windows 7 (64 bit). I also created the data / db path, but when I tried to start mongodb using the command 'C:\mongodb\bin\mongod.exe' , it does not start. This shows the admin web console waiting for connections on port 28017 .

Help me in starting MongoDB. And also please suggest if any GUI is available for MongoDB.

+124
windows-7-x64 mongodb connection
Dec 27 '13 at 7:31
source share
17 answers

Step 1

Download mongodb

Step 2

  • Follow the usual setup instructions.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Step 3

  • Create the following folder

C:\data\db

Step 4

  • cd to C:\Program Files\MongoDB\Server\3.2\bin>
  • enter the mongod command
  • by default, the mongodb server starts from port 27017

enter image description here

Step 5

  • (optional) download RoboMongo and follow the normal setup instructions

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Step 6

  • Launch RoboMongo and create a new connection on localhost:27017

enter image description here

Your mongodb is up and running with RoboMongo, a third-party GUI

+256
May 31 '16 at 14:11
source share

It worked for me

 mongod --port 27017 --dbpath C:\MongoDB\data\db 
+85
Jun 18 '15 at 2:51 on
source share
  1. Download from http://www.mongodb.org/downloads
  2. Install the MSI file in the folder C: \ mongodb
  3. Create data , data \ db , log directories, and the mongo.config file in C: \ mongodb .
  4. Add the following lines to the mongo.config file

     port=27017 dbpath=C:\mongodb\data\db\ logpath=C:\mongodb\log\mongo.log 
  5. Start server:

     mongod.exe --config="C:\mongodb\mongo.config" 
  6. Connect to the local MongoDB server through the command line

     mongo --port 27017 
  7. Connect to the remote MongoDB server through the authentication command line.

     mongo --username abcd --password abc123 --host server_ip_or_dns --port 27017 

It !!!

+55
Apr 08 '16 at 21:38
source share

Step 1: First download the .msi ie installation file from

https://www.mongodb.org/downloads#production

Step 2: Install using the downloaded .msi file. Automatically it is saved in program files. You can perform a custom installation and change the directory.

After that, you can see the Mongodb folder

Step 3: Create a new folder in this Mongodb folder called "data". Create a new folder in the data directory named "db".

Step 4: Open cmd. Change to the directory where your mongodb folder exists, and navigate to a path, for example C: \ MongoDB \ Server \ 3.0 \ bin. In the bin folder you should have mongodb.exe

Step 5: Now Use

 mongod --port 27017 --dbpath "C:\MongoDB\data\db" 
+24
Dec 09 '15 at 7:02
source share

Create the MongoDB service on Windows. First open cmd with admin

 mongod --port 27017 --dbpath "a mongodb storage actual path eg: d:\mongo_storage\data" --logpath="a log path eg: d:\mongo_storage\log\log.txt" --install --serviceName "MongoDB" 

After that

Start service

 net start MongoDB 

Stop service

 net stop MongoDB 
+19
Sep 13 '17 at 4:27
source share

there are 2 ways to start mongoDB installation location (for example: C: /)

first of all: copy the mongoDB folder to the C: / folder, then change the name to "mongodb" or whatever you need. here ex named "mongodb"

1: setup mongoDB is a windows service -

  1.1 : Make directory name "data" in C:/ ( so we have C:/data ),after that make directory "C:/data/db" <br> 1.2 : run in CMD ( Run as Admin) command -> "echo logpath=C:/mongodb/log/mongo.log > C:/mongodb/mongodb.cfg" <br> 1.3 : run in CMD (Run as Adin) command -> "C:/mongodb/bin/mongod.exe --config C:/mongodb/mongod.cfg --install" <br> 1.4 : run command "net start MongoDB" <br> 

2: a small .BAT file to run mongoDB without installation, copy and paste into notepad and save the file with the file type ".bat" here it is:

 C:\mongodb\bin\mongod.exe โ€“dbpath=C:/mongodb/data/db PAUSE 

if you get error 1078 or 1087 allows you to delete all data in C: / data / db and restart mongoDB (copy the old data to a new folder and back up after restarting mongoDB)

3. GUI for mongoDB

I am using rockmongo

have fun with it

+15
Dec 27 '13 at 10:49
source share

I followed the steps below ... Maybe this will work for you.

Create a directory as shown below

C: \ DATA \ DB

 mongod --port 27017 --dbpath "C:\data\db" 

It worked for me ....

+10
Dec 03 '16 at 22:30
source share

It is correctly written over here.

If you download the .msi file, install it, and if you download the zip file, extract it.

Set up your MongoDB environment.

MongoDB requires a data directory to store all data . The default path of the data directory is MongoDBs \ data \ db . Create this folder using the following commands from the command line:

md \data\db

You can specify an alternative path for data files using the --dbpath option for mongod.exe, for example:

C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data

If your path includes spaces, enclose the entire path in double quotes, for example:

C:\mongodb\bin\mongod.exe --dbpath "d:\test\mongo db data"

You can also specify dbpath in the configuration file.

Launch MongoDB.

To start MongoDB, run mongod.exe. For example, from the command line:

C:\mongodb\bin\mongod.exe

Connect to MongoDB.

To connect to MongoDB through the mongo.exe shell, open another command prompt.

C:\mongodb\bin\mongo.exe

+6
May 7 '16 at 19:31
source share

It is showing admin web console waiting for connections on port 28017.

The above message means that mongodb has started successfully and is listening on port 28017.

You can use the mongo shell ( mongo.exe ) to connect to mongoDB and perform db operations.

There are several graphical tools for MongoDB, such as MongoVUE, etc.

+4
Dec 27 '13 at 7:35
source share

Installing MongoDB on Windows is a bit more complicated compared to other executables ... Got some good help after a long search, which I got Installing MongoDB on Windows

After installation, open a command prompt and enter "mongod", then minimize the window and open another command prompt window and enter "mongo", and you will see a message about successful connection to the test database.

Hope help

+4
Aug 6 '17 at 19:18
source share

In fact, the Windows-way to use the service, from the official documentation :

  • Find out where your executable is installed, the path may be as follows:

    "C: \ Program Files \ MongoDB \ Server \ 3.4 \ bin \ mongod.exe"

  • Create a configuration file with this content (yaml format), the path may look something like this:

    "C: \ Program Files \ MongoDB \ Server \ 3.4 \ mongod.cfg"

 systemLog: destination: file path: c:\data\log\mongod.log storage: dbPath: c:\data\db 
  • Run the admin command with the following command (run the command line as admin):
 C:\...\mongod.exe --config C:\...\mongod.cfg --install 

If the paths are reduced using dots, see above.

The --install tells mongo to install itself as a Windows service.

Now you can start, stop, restart the mongo server, as the regular Windows service chooses your favorite method:

  • from Control Panel โ†’ Administration โ†’ Services โ†’ MongoDB
  • by executing a command from the command line as admin: ( net start MongoDB )

Check the log file specified in the configuration file if problems occur.

+2
Sep 12 '17 at 19:02 on
source share

This is ALL I need to run mongo in PowerShell, many of the answers are too complicated for IMO.

  1. Install: https://www.mongodb.com/download-center#community
  2. Add C:\Program Files\MongoDB\Server\3.6\bin to the path environment variable. Please note: this version will be out of date soon.
  3. Turn on the new PowerShell as it gets environment variables at startup, then type mongod
  4. Open another PowerShell window and enter mongo - you have access to mongo REPL! If you do not, just repeat 4 again (known error: https://jira.mongodb.org/browse/SERVER-32473 )
+2
Feb 16 '18 at 12:36
source share

Obviously, many people answered your question about how to make mongoDb work, I would answer the second part: Regarding the corresponding GUI for mongoDB

My suggestion is to go for MongoChef (now Studio 3T)

You can easily install and use it.

You might want to refer (from 03: 10- to 08:50): https://www.youtube.com/watch?v=0ws3oIyqieY&index=2&list=PLS1QulWo1RIZtR6bncmSaH8fB81oRl6MP

For a step-by-step guide to the GUI tool.

+2
Sep 18 '18 at 15:09
source share

the extra thing you can do is amazing

is that you can add "C: \ Program Files \ MongoDB \ Server \ 4.0 \ bin" to the system environment variables, this will allow you to run the "mongod" command anywhere in your cmd without going to the bin directory every time.

- note that the path to the bin directory may be different in your case -

so arrange everything

1- create the data / db folder on your drive c "this is the default path, mongo will look for a place to store your database files, so you do not need to specify it with '--dbpath'"

2- add "C: \ Program Files \ MongoDB \ Server \ 4.0 \ bin" to your system environment variables.

3- open type CMD "mongod"

4- have fun

- I saw it on a YouTube channel called "thenewboston", which is also amazing -

+1
Feb 10 '19 at 23:00
source share

Download the MongoDB Community Server at - https://www.mongodb.com/download-center/community

Installation takes some time. After doing this, follow these steps to get your running running server.

  1. Go to drive C, create a folder called data and inside it create another folder called db.
  2. Now go to the directory where the monodb server is installed. Go to C: \ Program Files \ MongoDB \ Server (version) \ bin. Copy this file location.
  3. To make server startup easier in the future, press the Windows key and enter the environment variables.
  4. You will see the option "Edit system environment variables".
  5. In the lower right corner you will see the button "Environment Variables ...". Click this.
  6. Under System Variables, double-click the path.
  7. Click on a new one and paste the location of the file you copied earlier.
  8. Now open cmd and enter mongod.exe (this is the daemon on which the server is located.)
  9. Open another cmd window and enter mongo.exe. The connection will be established, and now you are ready to go.

Thanks for reading. Hope it helps.

+1
Mar 15 '19 at 20:42
source share

For Windows users:

To add @CoderSpeed โ€‹โ€‹answer above ( CoderSpeed โ€‹โ€‹answer ). Create a batch file (.bat) with the commands that you usually enter in the CLI, for example:

cd "C:\Program Files\MongoDB\Server\4.0\bin" mongod.exe

The Windows Script Host Launch Method allows you to run a program or script in invisible mode. Here is a sample Windows script code that silently runs a batch file called syncfiles.bat.

Suppose we have a file called syncfiles.bat in the C: \ Batch Files directory. Let's run it in stealth using Windows Scripting.

Copy the following lines into Notepad.

Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "C:\Batch Files\syncfiles.bat" & Chr(34), 0 Set WshShell = Nothing

Note. Replace the name / path of the batch file in the script according to your requirement. Save the file with the extension .VBS, say launch_bat.vbs. Change the name and path of the .BAT file accordingly and save the file. Double-click to launch the launch_bat.vbs file, which in turn silently launches the syncfiles.bat batch file.

Retrieved from: run .BAT files silently

0
Jun 08 '19 at 8:28
source share

I did below, this works for me on Windows.

Open a command prompt in administrator mode (right-click the command prompt and select "Run as administrator").

then run the command below

 net start MongoDB 
0
Jul 10 '19 at 5:24
source share



All Articles