Download, install and start mongodb
Download website:https://www.mongodb.com/downl…
After downloading, unzip and rename the unzipped folder to a shorter name, such as mongodb
Start the terminal and enter the mongodb directory (my file path is / users / mobike / documents / mongodb)
To create a new / data / DB folder, enter:
$ sudo mkdir -p /data/db
/Data / DB is the default database storage directory of mongodb
Then enter the bin directory and enter
$ cd bin
$ sudo ./mongod
Mongod is used to connect to the mongodb database server, that is, the server side.
You can see the information after the database is successfully started, such as PID, port, dbpath, etc
Then open a terminal again!!! Similarly, enter the mongodb / bin directory and enter:
$ ./mongo
Mongo is used to start the mongodb shell, which is the command line client of mongodb
After successful startup, you can see the address and port number of successful connection: mongodb://127.0.0.1 :27017
You can see that the database is started successfully, and you can access ithttp://localhost:27017/
Installation and connection of adminmongo
Adminmongo: a visual data management tool for mongodb
Installation and startup:
$ git clone https://github.com/mrvautin/adminMongo
$ cd adminMongo
$ npm install
$ npm start
PS. in the figure above, I enter the adminmongo directory and execute $NPM start, because the installation path of my adminmongo is / documents / adminmongo.
You can see that adminmongo started successfully
openhttp://0.0.0.0: 1234 / you can see the following interface:
Connect to local mongodb:
Connection name: any one, required
Connection string:
- The rules for connecting mongodb are: mongodb: / / < user >: < password > @ 127.0.0.1: < port > / < DB >
- Where < user >: < password > < DB > can not be filled in
- Enter the URL to display when Mongo starts: mongodb://127.0.0.1 :27017
Click Add connection to display:
Click Connect, and a visual interface similar to the following will appear. The connection is successful!
Connect to remote mongodb:
You need to know the URL address, user name and password information of the remote database, and input them in the connection string in the format of mongodb: / / < user >: < password > @ 127.0.0.1: < port > / < DB > (don’t forget to fill in the connection name ~)
So far, mongodb has been installed and visual management has been realized with adminmongo. You can continue to learn other operations of Mongo:
http://www.runoob.com/mongodb…
Come on, boy~