In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What the editor wants to share with you this time is how to quickly install and start mongodb on the win7 platform. The article is rich in content, and interested friends can learn about it. I hope you can get something after reading this article.
Write at the beginning
Recently, I have been learning the knowledge of nodejs operating mongodb, but I found that every time I start mongodb, I need to type a long instruction, cd all the way to mongodb's bin directory and write a long list of things to start, which is particularly annoying and error-prone. So I figured out how to make it start easily and quickly.
Since the machine I am using is a win7 system, this article may only be valid for win7 systems.
Download and install
Download the .msi file directly and install it to the specified directory. My installation path is D:\ mongodb
Then create a new blog folder under the root directory as the data storage directory (most of the tutorials on the Internet are named data, as long as you know it yourself).
At the same time, create a new logs folder under the root directory as the place to store the log files.
Now it might look like this:
Set system variabl
The purpose of this step is that the mongod command can be executed directly from the cmd console without having to cd all the way to the\ bin directory.
My computer-- properties-- advanced system settings-- environment variables-- system variables, find PATH, double-click to edit, and add at the end; D:\ MongoDB, pay attention to the semicolon before, and finally click OK. As shown in the figure:
Start mongodb
Now, we can directly cmd to open the command line and type directly
Mongod-- dbpath=D:\ MongoDB\ blog. If there is this sentence at the end of the output, it means that mongodb has been started successfully, and the port number is 27017.
We type localhost:27017 in the browser, and the page will display "It looks like you are trying to access MongoDB over HTTP on the native driver port." Indicates that the startup was successful.
At this time, a new command line window is opened, and the mongo instructions can be executed directly.
A faster way
Through the above steps, we have solved the problem of "all the way cd", but you still need to write mongod-dbpath=D:\ MongoDB\ blog to start mongodb. As a very lazy person, I really don't want to write such a long sentence every time. So is there a faster way? Yes!
We can take mongodb as a boot task and turn it on when the system is turned on!
Open the cmd console and enter
Mongod-dbpath=D:\ mongodb\ blog-logpath=D:\ mongodb\ logs\ mongodb.log-install
At this point, a mongodb.log file will appear in the\ logs folder, which contains some mongodb logs.
Now mongodb can be started with the system. In the future, we need to connect to the mongodb database, just enter net start mongodb in the cmd console, and the console will output:
You need to close mongodb, just enter net stop mongodb, and the console will output:
It's done!
After reading this article on how to quickly install and start mongodb on the win7 platform, if you think the article is well written, you can share it with more people.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.