MongoDB Installation with MongoDB service configurationMongo DB is a non-relational database (NOSQL) that is currently very popular in the IT industry, and its flexible data storage methods are highly favored by current it practitioners. Mongo DB is a good implementation of object-oriented thinking (Oo idea), in Mongo db each record is a document object. The biggest advantage of Mongo DB is that all data persistence requires no developers to write SQL statements manually, and it is easy to invoke methods to implement CRUD operations.
First, Installation:
1. Official website: http://www.mongodb.org/downloads, download the 32/64-bit MSI format installation package for the corresponding system
2. Installation path: Example D:\MongoDB (path optional, but not too deep)
3. Installed configuration:
Create a new Data folder under D:\MongoDB\
Create a new DB and log folder under D:\MongoDB\data
Create a new MongoDB.log file under D:\MongoDB\data\log
Second, start:
1. Go to D:\MongoDB\bin and enter:
1 |
mongod --dbpath D:\MongoDB\data\db |
Role: Create a MongoDB database file into the D:\MONGODB\DATA\DB directory
The interface will now stop at
2016-10-26t14:55:37.044+0800 I NETWORK [Initandlisten] waiting for connections on port 27017
The database is now started.
2. Open a new CMD window, run the Mongo.exe program, at which time the previous window displays
2016-10-26t14:56:05.855+0800 I NETWORK [Initandlisten] connection accepted from 127.0.0.1:60584 #1 (1 connection now OPEN )
You can now use the MongoDB database.
Third, use:
1. Enter MONGO into the MONGO command interface and enter the use TestDB to create the TestDB database.
2. Enter Db.adduser ("Test", "123") to create a user for TestDB
Note: V3 version MongoDB no longer uses adduser, but instead uses the Db.createuser
Db.createuser ( { User: "Accountuser", pwd: "Password", roles: ["ReadWrite", "DbAdmin"] })
MongoDB Local Installation and enablement (Windows)