Windows installs MongoDB key-value pair database


foreword

MongoDB is a database based on distributed file storage, written in C++ language, designed to provide scalable high-performance data storage solutions for WEB applications.

MongoDB stores data as a document. The data structure consists of key-value (key=>value) pairs. MongoDB documents are similar to JSON objects, and field values ​​can contain other documents, arrays, and document arrays.

The MongoDB server can run on Linux, Windows or mac os x platforms, supports 32-bit and 64-bit applications, and the default port is 27017.

MongoDB supports various programming languages: Python, Java, C++, PHP, C# and many other languages.


1. How to install

1. Download version 4.0.28 from the official website Download MongoDB Community Server | MongoDB ,

2. Select window msi 

3. Click the installation package to install

3.1 During the installation process, you can set your installation destination by clicking the "Custom" button

3.2 Select the directory to be installed next

3.3 directly next

Then continue to next and wait for the installation to complete

 First, create a db folder and a log folder in the data folder of MongoDB, then create a mongo.log under the log folder, and then add the path of the D:\SoftWare\Mongodb\bin bin directory to the environment variable

 

 

4. Then enter mongo from cmd in the bin directory, and the version number is displayed, and the installation is successful

 

5. After installation, there is no password by default. You can continue to use it or create your own user and password. 

I have configured a password

Just continue to enter the command after the fourth step

The first command use admin;
the second 

db.createUser({   user: 'admin', // username   pwd: '123456', // password   roles:[{     role: 'root', // role     db: 'admin' // database   }] });






 

After the super administrator user is successfully added, there is a file  in the bin directory of D:\SoftWare\Mongodb\binmongod.cfg

Click edit to find 
#security:

Under it, turn on password verification

security:
  authorization: enabled

 

 

Finally, open the task manager to find the MongoDB service and restart it to make the configuration take effect, then you can use the password to log in to the database

 

2. Use Navicat Premium 12 to connect

 

When the icon and version number are displayed, the connection is successful using the tool 

 

 


Summarize

first day
 

Guess you like

Origin blog.csdn.net/qq_55648724/article/details/128137150