MongoDB Use DB Show dbs

Source: Internet
Author: User

MongoDB Common commands:

Switching between DBS with use Xxxdb

Then the operation is only for XXXDB;

Show DBS shows all databases

Show collections Display all collections

MongoDB database is generally installed under USR Local

./mongod--dbpath=/usr/local/mongodb/db--fork--logpath=/usr/local/mongodb/logs/1. Log

Enter the/usr/local/mongodb/bin directory to run./mongod Start MongoDB

Add various parameters behind MongoDB

For example:

Run./mongo The local database is connected by default and can be manipulated after entering the shell console mode

But start MongoDB to run in the background to add the--fork parameter

The parameters of other functions are remembered as double bars--

--dbpath--logpath LogPath parameter is followed by a directory plus a specific file or it will be an error

A common practice is to create a new mongodb.conf configuration file under the bin file

Configuration files are well configured.

dbpath=/usr/local/mongodb/dblogpath=/usr/local/mongodb/logs/mongodb.logport=27017 Fork=truenohttpinterface=true

Then set

Vi/etc/rc.d/rc.local
/usr/local/mongodb/bin/mongod--config/usr/local/mongodb/bin/mongodb.conf

You can turn it on and start.

MongoDB Use DB Show dbs

Related Article

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.