Detailed illustrations documenting the process of installing the MONGO database in Win7 64. The installed version is mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed.
I downloaded the source file: mongodb-win32-x86_64-2008plus-ssl-3.4.1-signed
My system: Win 7 bit 8g memory
To facilitate the download, I put the package I downloaded at that time on a certain degree of cloud disk.
Link: http://pan.baidu.com/s/1o80MF1o Password: fi3k
Download and installation, a little more pictures, not afraid of wordy, afraid enough.
Pay attention to the location of this installation, and use it below.
The picture is said to have just installed the appearance of the time, hit a typo.
1. Create several folders as follows: Database path (data directory), log path (logs directory), and log file (Mongo.log file)
Note the front and back comparison of folders:
2. Create the configuration file mongo.conf, the file contents are as follows:
[HTML]View PlainCopy
- #数据库路径
- dbpath=D:\MONGO\DATA  
- #日志输出文件路径
- logpath=D:\MONGO\LOGS\MONGO.LOG  
- #错误日志采用追加模式
- logappend=TRUE  
- #启用日志文件,  &NBSP is enabled by default;
- journal=TRUE  
- # This option can filter out some useless log information, if you need to debug use set to FALSE  
- quiet= TRUE  
- #端口号 default to 27017
- port=27017   
3. Start MongoDB Service
Mongod--config "D:\Mongo\mongo.conf"
This is to start the service using the configuration file that you have just configured above. Note Modify the directory location to your own. Well, of course this is the corresponding installation bin directory in the cmd command-line window dropdown
This is executed at the cmd command line, after execution, the command line does not seem to change much, and then you proceed to the following steps.
This step, in the fourth step below, you can see this step of the command execution effect. You can look at the next step diagram.
After the command executes, enter http://127.0.0.1:27017 in the browser to see the following interface that indicates the success of the launch
Some may fail here, perhaps the page does not show so, but it does not matter, you see just the data directory there is no file generation, there is no content log file. If there is, then the service is started,
You can also, in the Task Manager, see if there is such a MONGO service. All can be judged by this service start OK No.
4. Create and start the MongoDB service
It would be rather troublesome to create and start the MongoDB service by using the Windows service to manage the startup and shutdown of MongoDB if the operation is done on a per-action basis.
Mongod--config "D:\Mongo\mongo.conf"--install--servicename "MongoDB"
net start MongoDB
It's a 2-line command.
The start of this service is a bit special. No login verification is required, or you can log in without a password.
Concrete look. This is the effect that you see with Mongovue login
Wait a minute, the description on the diagram is not very correct , it should be I created a database called LXKDB, the other 2 of the above is called admin, and Local is installed after MONGO DB, automatically generated database.
You can also see that there is no database called Test, so it is wrong to say that the system has a database called test by default. The following will also explain the problem.
This sentence was later updated: It said that this test does not exist, is not entirely right, specifically, the bottom of the explanation it. Don't care about this first.
where Admin This database is stored user information.
About this user information, not as simple as we think, just save a username and password is finished.
MongoDB default is not set permissions, that is, no access permissions set. The above startup method is not set permissions to start, so, log in to the database, there is no need to verify the user name and password.
This means that as long as the port of the MongoDB server is known, anyone who can access the server can query and manipulate the contents of the MongoDB database.
That is, as I tested above, do not enter anything, you can directly test connection OK.
so : add--auth so that you can use the user name and password later to do MONGODB related operations
MongoDB Users and permissions, this is a little complicated, first of all, an impression.
There are two kinds of database users, one is administrator, used to manage users, one is a normal user, to access data.
(I'll continue to talk about how the database users of both kinds of permissions are using it)
Attention:
Below this with permission to control the installation of services, you, temporarily do not complete, this permission if you open, you must first build an account and password in the database.
This is like the reason you have to have the key ready before you lock the lock. Therefore, in the case you do not understand this permission, temporarily do not add this permission control.
Wait until you see how to create a new administrative user and a general database user before you open this permission. I'll make a good summary of it later.
Explanation of--safety and certification:
the database in each MongoDB instance can have many users. If security checks are turned on, only database authenticated users can perform read or write operations.
< Span style= "font-size:14px" > In the context of authentication, mongodb< Span style= "font-family: Song Body" will be the normal data as admin database processing. admin Users in the database are considered super users (
After authentication, administrators can read and write all databases and execute specific administrative commands, such as listdatabases and shutdown.
Be sure to have at least one administrator account before you start the security check.
Back Links: detailed schematic records Win7 MongoDB new manager account and general account examples
(This time you have just started to learn, you can not open the permission to verify, then when logging into the database, you do not need an account and password, the operation is simple.) )
(The following action is to open permission authentication, before using the database, you must first verify that you can continue, authentication, that is, often see this word.) )
Then, the service to uninstall (the following explains how to uninstall the service, I do not repeat), and then re-register a service, command to add a--auth.
Mongod--config "D:\Mongo\mongo.conf"--auth--install--servicename "MongoDB"
net start MongoDB
You can also add a auth=true configuration to the configuration file. The effect is almost right.
Then you can't just log in without a password.
Note: This Mongovue version is too low, resulting in even if your account password OK, or there will be abnormal situation, after I have been a lot of unloading load service, changed a MONGO database Tools, special is OK.
Let's ignore the error of the tool for the time being. Next I demonstrate how to use this database, in this know this permission problem, just fine.
And this permission problem, is very troublesome.
The MONGO service that has just been installed has a default database, and Test,user's name and PWD are test. Such as. (This sentence is overturned below, the theory is not tenable.) )
Point test, testing, connection is not OK. And then there's the
Originally I was to read someone else's article said, MONGO just installed, there is a test database, and then the user name and password are test, and then I use that mongovue this visual tool to test the next.
The test connection was found to be OK, as shown above. Then I thought there was a real database, but then I thought, "No, it's not like that."
After I repeatedly test that permission problem, found that this mongovue, even if you do not fill in the user name and password, fill in the database name, and then test the connection, you can also test OK.
But I use another newly discovered MONGO database tool that doesn't have this problem.
And also use this MONGO database tool, you can see that --auth utility or exist , that is, this time, must have an account name and password to use the database.
I have not tested this time, no permission to control the start-up service, and then use this login database to see what the situation.
Have time, or, crossing you to test the Bai. Just didn't add--auth when the service is started, is not without the account password, you can use this tool to connect to the database.
The URL of the tool that connects the database is an open source project.
Robomongo 0.9.0
http://blog.robomongo.org/robomongo-0-9-0-final/
I downloaded to a certain degree of cloud disk share
Link: Http://pan.baidu.com/s/1bp8ALDP Password: Iaie
After comparing the two tools, you can see that the Mongovue version is really too low. The next article has this Mongovue version of the map.
If you need to uninstall the MongoDB service , it is still in the bin directory,
Mongod.exe--remove--servicename "MongoDB"
Then the service is deleted, and then you can't see the service in that Task Manager. It means he was killed. deleted.
Described above is from the installation of MONGO services to uninstall the MONGO service, there is a picture of the truth.
Here are some other things to do.
In the future if you want to stop this service , you right-click, start the Task Manager, select the service above, then the bottom right corner of the "service (s) ...", and then find the system called MongoDB Service, turn it off.
At this point, all operations have been completed and the service has been successfully installed.
I will temporarily first put this MONGO database on my computer, how to use the specific. Say it later.
This time, look at just our new Data folder and Mongo.log two files in the time we found that there is information, it can also be explained that the operation is OK.
The amount, hehe, is I this picture upload a bit more ...
Finally, every time you want to use the MONGO command at the command line, you have to go into the corresponding bin directory, this is very troublesome, why not configure a system environment variable, convenient for direct use, this MONGO command
This can be directly on the cmd command line, do not need to do directory switching, you can directly use the
Explanation of the existence or not of the test database inside the database:
The next article specifically explains how to create a common database user and database Manager user.
That is, the above you see two database is and login database account and password is how to set.
(I've added the link to the inside of the article.) You can click on the link to view. )
Detailed illustration of MongoDB 3.4.1 win7x64 installation