Installation and configuration of MongoDB under Ubuntu system

Source: Internet
Author: User
Tags install mongodb

Installing MongoDB

sudo apt-get install MongoDB

sudo apt-get install MongoDB



Close/Start

sudo service MongoDB stop
sudo service MongoDB start

To set the database connection password:

  Creating a folder with directory: data/db

  Close the existing service.

sudo service MongoDB stop

  Restart Service

$ mongod–auth

  Create a connected user

$ MONGO

> Use admin

Switched to DB admin

> Db.adduser ("Root", "1983")

  Close the Service ( Command window launched directly in Mongod "CTRL + C")

  Restart Service:

$: Mongod–auth

  To see if validation starts:,

$ MONGO

MongoDB Shell version:2.0.4

Connecting To:test

> Use admin

Switched to DB admin

> Show Collections

Fri Mar 09:07:08 uncaught exception:error: {

"$err": "Unauthorized db:admin lock Type:-1 client:127.0.0.1",

"Code": 10057

}

  There is a hint link error.

  For user authentication:

> Db.auth ("Root", "1983")

1

  Re-view to view datasets

> Show Collections

System.indexes

System.users

To set up a client connection:

  The default installation allows only 127.0.0.1 IP connections.

  The following records need to be modified/etc/mongodb.conf comments:

  Open File:

$ sudo gedit/etc/mongodb.conf

  Note Record:

#bind_ip = 0.0.0.0

Installation and configuration of MongoDB under Ubuntu system

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.