MongoDB practice: (1) install

Source: Internet
Author: User
MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Install: 1. Run: D: Toolsmongodbbingt; mongod -- dbpathE: MyProject on the console

MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Installation: 1. Run: D: \ Tools \ mongodb \ bingt; mongod -- dbpath E: \ MyProject \ on the console \

MongoDB does not provide the installation package. You can download the package directly to learn how to use it. Installation:

1. Run: D: \ Tools \ mongodb \ bin> mongod -- dbpath "E: \ MyProject \ Web \ mongo \ data" on the console. Note that mongod is not mongo. It took me more than 10 minutes to solve the problem. You can also use the default DB, and create the db \ data folder under drive C. You do not need to add the following parameters. Run cmdd.exe directly.

2. Start another console and run: D: \ Tools \ mongodb \ bin> mongo to view the Mongo system prompt.

3. MongoDB provides a database named test by default, so you can use it directly:

> Db. test. save ({a: 1 })

> Db. test. find ()

4. It's really convenient!

---------------------------------------------

Continue. It is a little troublesome to start two consoles with MongoDB each time. Fortunately, in Versions later than 2.0, it can run as a service for windows:

1. Prepare two items: log folder and configuration file.

2. Create: E: \ MyProject \ Web \ mongo \ log

3. Create the configuration file mongod. cfg in the MongoDB installation directory. The content is as follows:

Logpath = E: \ MyProject \ Web \ mongo \ log \ mongo. log
Dbpath = E: \ MyProject \ Web \ mongo \ data

Note that dbpath must be filled in correctly, otherwise the service will not run normally!

4. Use the Administrator permission to install the service: D: \ Tools \ mongodb \ bin> mongod -- config "D: \ Tools \ mongodb \ mongod. cfg" -- install

5. A service named MongoDB will be installed in the system. You can manually start the service or execute net start MongoDB to start the service. If the service script is wrong, you can delete the service by running the command "C: \ mongodb \ bin \ mongod.exe -- remove" or "SC delete mongoDB.

Related reading: VMWare's Cloud Foundry practice (2): successful connection with MongoDB

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.