Windows installation Mongodb

Source: Internet
Author: User
Tags create mongodb mongodb server mongodb windows new windows 10

Because the new Windows 10 computer, you need to reinstall all the software on the new computer, including MongoDB

download file : Start with the latest version of MongoDB installer on the official website of MongoDB, https://www.mongodb.com/, scroll Web page to try MongoDB for free

Select the Community Server Community version and select the installation version of Windows

installation : Started to try to download the latest version of the 3.6.1 version of the MongoDB website can not enter the installation, because its internal needs to access to Compass-install.exe, if it is a personal computer, I believe there is no problem

No way, can only be used back to the original version 3.4.4 version, installation, and no such problems

Select an installation location, select a selected installation location (C:\MONGODB), after the installation is complete, you can see that the installed file already exists in the directory

You can manually create two empty folders in C:\mongodb

C:\mongodb\data\db

C:\mongodb\log

and create an empty mongo.log below the C:\mongodb\log.

start the server : Run the cmd Command window as Administrator in Win10, and go to the C:\mongodb\bin directory, run the command, which is already running MongoDB server, normal words should have a line of text indicates that the server has been started normally, But my computer did not, do not know what the reason

CD C:\mongodb\bin
Mongod--dbpath C:\mongodb\data\db--logpath=c:\mongodb\log\mongodb.log--logappend

Connect : Use the cmd Command window and go to the C:\mongodb\bin directory to run the command

Mongo

start MongoDB as a Windows service : The above start-up server is only one-time, when the command window is closed, the server will shut down, you can start MongoDB as windows, so that a boot, MongoDB service has been started

Mongod--dbpath C:\mongodb\data\db--logpath=c:\mongodb\log\mongodb.log--logappend--install--servicename "MongoDB"

or open the browser, enter the address http://localhost:27017, or the http://127.0.0.1:27017

When you view system services, you can see that the MongoDB service is running

The above screen indicates that MongoDB's Windows service has started smoothly and can then use the command MONGO to connect to the server

use configuration file to start MongoDB service : Create a file mongodb.conf in C:\mongodb\config, adding a configuration file is the same as running the command directly

DBPATH=C:\MONGODB\DATA\DB            # database file logpath=c:\mongodb\log\mongodb.log    # log file logappend=true                        # Log in append mode, After you configure the MongoDB log to append to an existing log file, do not recreate a new file Journal=true                        # Enable log file, Quiet=true # enabled by default                            # This option can filter out some useless log information, if you need to debug use please set to falseport=27017                            # port number defaults to 27017

Then run the command

SC create MongoDB binpath= "C:\mongodb\bin\mongod.exe--service--config=c:\mongodb\config\mongodb.conf"

Remove MongoDB Windows service : If you no longer need MongoDB for Windows services, you can manually turn it on and delete

#可以在任何目录运行该命令
SC Delete MongoDB

or run the following command in the MongoDB bin directory

Mongod--remove--servicename "MongoDB"

add MongoDB to the environment variable : At this point into the MongoDB directory can use the MongoDB command-line tool, if in other directories, is not able to use the MongoDB command-line tool, We can add the MongoDB directory to the environment variable, so we can use the MongoDB command-line tool in any location.

Open the Windows Settings window, enter the variables, and click "Edit System Environment variables"

Click Environment variables

Add the MongoDB Bin directory to the PATH environment variable

After adding environment variables, you can use the MongoDB command line tool in any directory.

Use of the MongoDB graphical tool

Click the Connect icon

Click Create, enter the address and port of MongoDB, we connect 27017 of this machine

When you click Connect to a server, you can see the default MongoDB database

Windows installation Mongodb

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.