Remember to run in administrator mode CMD, Otherwise, the service will fail to start .
Detailed illustration , Record win7 64 install mongo Database process . The installed version is MongoDB-win32-x86_64-2008plus-ssl-3.4.1-signed.
- Download and install , There are a lot of pictures , I'm not afraid to talk , I'm afraid it's not enough .
The picture shows what it looked like just after the installation , Wrong type .
- Create several folders as follows ： Database path （data Catalog ）、 Log path （logs Catalog ） And log files （mongo.log file ）
Pay attention to the contrast between the front and back of the folder ：
- create profile mongo.conf, The contents of the document are as follows ：
# Database path
# Log output file path
# The error log is in append mode
# Enable log files , Enabled by default
# This option can filter out some useless log information , If you need to debug, please set to false
# Port number The default is 27017
- start-up MongoDB service
mongod --config "D:Mongomongo.conf"
This is to start the service by using the configuration file you just configured above . Pay attention to change it to your own directory location . forehead , This, of course, is cmd The corresponding installation of the command line window bin The directory drop-down is in cmd This command is executed from the command line , After execution , Command line , There doesn't seem to be much change , Then you go on with the following steps . A screenshot of this step , In the fourth step below, you can see the command execution effect of this step . Take a look at the following step diagram first .
After the execution of the command , Browser input http://127.0.0.1:27017 If you see the following interface, it means that the startup is successful
Some may fail here , Maybe the page doesn't show that way , But don't worry , Look at the one just now data There is no file generation in the directory , also log What's in the file . If there is , So the service is up , It can also be in the task manager , See if there's such a mongo There is a service for . You can judge whether the service is started OK No, .
- Create and launch MongoDB service
If you do this every time , Isn't it rather troublesome , Follow the command below to create and start MongoDB service , You can go through windows Service to manage MongoDB The startup and shutdown of
mongod --config "D:Mongomongo.conf" --install --serviceName "MongoDB"
net start MongoDB
It's on it 2 The command
The start of this service , It's a little special . It doesn't need login verification , You can log in without a password . See the figure below for details. . This is for mongoVUE Login to see the effect
wait a minute , The description on the graph is not very correct , I should have created a database called lxkdb, The other one above 2 One is called admin, and local It's all installed mongo db after , Automatically generated database .
It can also be seen that there is no such thing as test The database of , So , By default, there is a system called test The database is wrong . This problem will be explained below .
This sentence was updated later ： It says this test non-existent , Not exactly , Let's see the explanation at the bottom . I don't care about that
among admin This database stores user information .
About this user information , It's not as simple as we think, just save a user name and password .
MongoDB By default, there is no permission set , in other words , No access rights set .
It means that as long as you know MongoDB The port of the server , Anyone who can access this server can query and operate MongoDB The content of the database .
That's what I tested above , Input nothing , You can test the connection directly OK.
therefore ： add --auth In this way, the user name and password can be used later MongoDB Related operations of
MongoDB Users and permissions , It's a little complicated , Let's have an impression first .
There are two types of database users , One is the administrator , To manage users , One is ordinary users , To access data .
（ Later, I will continue to talk about how the database users with these two permissions are using ）
Be careful ：
The following installation service with permission control , And you? , Don't fix it for now , If you open this authority , You have to create an account and password in the database first .
It's like you have to have the key ready before you lock the lock . therefore , If you don't understand the authority , For the time being, it's not like we don't add this permission control .
Wait to see how to create a new management user and a general database user before opening this permission . I'll summarize it later .
About -- Security and authentication -- The explanation of ：
Every MongoDB The database in the instance can have many users . If security checks are turned on , Only database authenticated users can perform read or write operations .
In the context of Authentication ,MongoDB Will take ordinary data as admin Database processing .admin Users in the database are considered superusers ( The Administrator ).
After certification , Administrators can read and write all databases , Execute specific administrative commands , Such as listDatabases and shutdown.
Before opening the security check , Be sure to have at least one administrator account .
It's followed by a link ： Detailed graphic records win7 64 mongodb Examples of new manager accounts and general accounts
then , The service has been uninstalled ( Here's how to uninstall the service , I won't repeat it ), And then sign up for another service , Command to add more --auth.
mongod --config "D:Mongomongo.conf" --auth --install --serviceName "MongoDB"
net start MongoDB
You can also add another one in the configuration file auth=true Configuration of . The effect is almost the same .
Then you can't log in directly without a password .
Attention! ： This mongoVUE The version of is too low , Cause even if your account password OK, Or there will be something unusual , After I've been through a lot of uninstalling and reloading services , A new one mongo Database tools , What's special is OK 了 .
Let's ignore the error report of this tool for the time being . Next I'll show you how to use this database , I know about this authority issue here , Just fine .
And the problem of authority , It is trouble .
Just installed mongo The service has a default database ,test,user Of name and pwd All are test. Here's the picture .
spot test, Test it , Is the connection OK Of . And then there's the picture above
Originally, I read other people's articles and said ,mongo Just after installation , There is a test database , Then the username and password are test, And then I use that mongoVUE This visualization tool tested .
Found that the test connection is OK Of , That is, as shown in the picture . And then I just I think this database really exists , But then I thought about it , Wrong! , It's not like that .
Later, when I repeatedly test that permission problem , Find out , This mongoVUE, Even if you don't fill in your user name and password , Fill in any database name , Then test the connection , It can also be tested OK Of .
But I use another new discovery mongo Database tools , There is no such problem .
And also use this mongo Database tools , You can see that --auth There is still the effect of , I haven't tested this yet , Start service without permission control , Then log in to the database and see what happens .
I'm free , perhaps , I'll give you a test . Just didn't add --auth When starting the service , No account password , You can use this tool to connect to the database .
The URL of this tool , It's an open source project .
I download to a certain degree of cloud disk sharing
link ：http://pan.baidu.com/s/1bp8ALDP password ：iaie
After comparing the two tools , You can find this mongoVUE The version of is really too low . Next To have this mongoVUE Version diagram of .
If you need to uninstall MongoDB service , It's still bin Under the table of contents ,
mongod.exe --remove --serviceName "MongoDB"
Then the service was deleted , Then you can't see this service in the task manager . That means he was killed . Deleted .
If you want to stop this service in the future , You just right-click , Start task manager , Choose the service above , And then in the lower right corner “ service (s)...”, And then find the one named MongoDB System services , Just turn it off
thus , All operations completed , The service has been successfully installed .
I'll take this for a while mongo My database is installed on my computer , How to use . later .
This is the time , Let's take a look at our new data The folder and mongo.log I found data in two files , It can also show that , The operation along the way is very OK Of .
forehead , ha-ha , It's just that I've uploaded a little too much ...
Last , Use it on the command line every time mongo command , You have to go into the corresponding bin Under the table of contents , It's a lot of trouble , Why not configure a system environment variable , Easy to use , This mongo command
In this way, you can directly in cmd Command line , No directory switching is required , You can use it directly
About... In the database test An explanation of whether a database exists or not ：
- MongoDB download + install + To configure + Error resolution
download Download from the official website : https://www.mongodb.com/download-center/community Server=>Download install Install after download is complete It is recommended to download the root directory ( Under ...
- MongDB4.1- Download, install and configure
Download, install and configure in three steps download ,MongoDB Official Website Download Center download _.msi_ Installed version install , Note the following steps : Choose Setup Type: Please Choose Custom Custom S ...
- win10 DVWA Download installation configuration （ Novices learn to infiltrate ）
The computer has been reinstalled , We need to re install the learning environment of penetration testing DVWA, I'd like to take this opportunity to talk about DVWA Installation process , Because of different computer configurations . The environment is different , On my computer, according to my installation tutorial, it is installed at one time . If you encounter ...
- Jmeter Download installation configuration and use （windows）
1 Preface Used only as a record . 2 step 2.1 Download address :http://jmeter.apache.org/download_jmeter.cgi 2.2 choice binary Version can :apache-jme ...
- MongoDB Installation configuration 、 Basic operation and Perl operation MongoDB
MongoDB Installation configuration . Basic operation and Perl operation MongoDB http://www.myhack58.com/Article/60/63/2014/42353.htm
- 01_2Java Download the development environment install To configure
01_2Java Download the development environment install To configure l To configure Java Development environment steps (WindowsXP) l Download and follow the latest version of J2SDK l Set up Windows environment variable l Choose the appropriate text editor or use the integrated open ...
- 2019-03-18 OpenCV Tesseract-OCR download install To configure （cv2 Report errors ）
OpenCV download install To configure 1. To download and Python The version corresponding to the version , This is the download address 2. install ( stay powershell Install in administrator mode ) pip3 install .\opencv_python-3.4 ...
- Use from scratch git Chapter one ： Download installation configuration
Use from scratch git Chapter one : Download installation configuration Chapter one : Use from scratch git Chapter one : Download installation configuration Second articles : Use from scratch git Second articles :git Practical operation Third articles : Use from scratch git Third articles :git Cancel the operation . Branch operations and ...
- JDK Download the installation configuration tutorial ( detailed )
JDK Download the installation configuration tutorial ( detailed ) Copyright notice : This is an original article , For reprint, please attach the original source link and this statement .https://www.cnblogs.com/mxxbc/p/11844885.html Because I need to be in Wi ...
- Windows32 Bit or 64 Bit download installation configuration Scala
[ Learning notes ] Windows 32 Bit or 64 Bit download installation configuration Scala: 1) Download address :http://www.scala-lang.org/download/, It's time to show me spark That section , requirement scala yes 2.1 ...
- Java Thread base instance
summary Java Thread is a basic function often used in actual combat development , And in the Java Thread related classes in java.lang and java.util.concurrent in Thread package thread.base ...
- asp.net C# cookies How to use
Response.Cookie("username").value="aa" write in username=Request.Cookies("username ...
- WWDC15 Session note - Xcode 7 UI A glimpse of the test
https://onevcat.com/2015/09/ui-testing/ WWDC15 Session note - Xcode 7 UI A glimpse of the test Unit Test stay iOS There are enough in development ...
- js in Array Object method
Operation method :concat() slice() splice() concat() Method to create a new array based on all the items in the current array . say concretely , This method creates a copy of the current array , Add the received parameter to the end of the replica , Last ...
- java Frame ---spring IOC Dependency injection
spring The ways of dependency injection are 4 Kind of Constructor injection Attribute injection Plant injection Annotation injection The following is a unified explanation through an example : User.java package com.bjsxt.model; public class ...
- sprintf Buffer overflow for
sprintf Buffer overflow for classification : technology 2010-03-07 15:26 362 Human reading Comment on (0) Collection report today , debugging sector I met a very strange problem when I was young , The program will pick up string Of c_str() ...
This article is about new Some understanding in the learning process , I wish to point out that there is something wrong , Receive critical education from the organization . Fuse , Some time ago, I studied jQuery When , See that there is such a paragraph in the source code : jQuery = function(select ...
- Mongodb monitoring
Original address : Wu Yizhou's blog Introduce Why monitor status , Because in the actual situation, something unexpected may happen , Like the problem of congestion , There are many reasons for congestion , If there is a block when we query the document , Then it will affect the back ...
- 201521123068 《java Programming 》 The first 13 Weekly learning summary
1. This week's learning summary In the way you like ( Mind mapping .OneNote Or others ) Summarize the related content of multiple networks . 2. Written work 1. Network foundation 1.1 Compare ping www.baidu.com And ping cec.jmu. ...
-  Copy data files from dg library .txt
 Copy data files from dg library .txt 1. Test environment :SCOTT@book> @ ver1PORT_STRING VERSION B ...