windows and mac Methods steps and precautions for installing mongodb databases

  • 2020-11-25 07:39:56
  • OfStack

nosql database -- mongodb database!

Mongo DB is a very popular non-relational database (NoSql) in the IT industry, and its flexible data storage method is favored by current IT practitioners. Mongo DB is a good implementation of the object-oriented idea (OO idea), in which every record in Mongo DB is an Document object. The biggest advantage of Mongo DB is that all data persistence operations do not require developers to manually write SQL statements, and the CRUD operation can be easily implemented by calling methods directly.

windows installation

I'm talking about the command-line installation method here

. To the official website to download the corresponding version https: / / www mongodb. org /

Note the distinction between 32 bits and 64 bits

1. Unzip the downloaded ES35en-win32-i386-1.8.1.ES38en, create the path D:\mongodb, and unzip the Bin file Copyto under this folder

2. Installation Attention (please look carefully)

The bind_ip binding service IP can only be accessed locally if the binding is 127.0.0.1. The default local IP is not specified The logpath specifies the MongoDB log file. Note that the specified file is not a directory The logging by logappend is appended The database path is specified by dbpath The server port number is specified by port. The default port is 27017 The service name is specified by serviceName serviceDisplayNam specifies the name of the service and executes when there are multiple mongodb services. The install specified is installed as an Windows service.

3. Installation (run cmd as administrator, open dos window and execute the following statement, mongod --bind_ip 127.0.0.1 --logpath"D:\mongo\data\ mongodb "log :\mongo\data\db" --port27017 serviceName"aiyouyang1" D:\mongo\data\ mongodb \ log" logappend :\mongo\data\db" --serviceDisplayName"aiyouyang2" --install

4. Check whether the installation is successful

(1) Execute mongod --dbpath D:\data\db in the same directory (D:\mongodb\bin) (2) Open http://localhost:27017/ in the browser and the following statement appears (3) It looks you are to accessMongoDB HTTP the ES1109en driver port (successfully installed)

mac installation

download

https://www.mongodb.com/download-center#community

Unzip and rename

[

tar -zxvf mongodb-osx-ssl-x86_64-3.6.3.tgz
mv mongodb-osx-ssl-x86_64-4.0.4 mongodb

]

Global environment configuration

[

export PATH=/yourPath/mongodb/bin:$PATH

]

Create a new data store directory and modify the permissions

[

sudo mkdir -p /data/db
sudo chomd 777 /data/db

]

Start the

[

mongod

]

conclusion


Related articles: