在linux下運行mongodb

來源:互聯網
上載者:User

標籤:insert   sudo   package   ons   etc   ice   conf   instr   name   

一》下載

1.去mongodb官網下拉框中找到 linux =>RHEL 6 =>

Package Manager:

2.Instructions for installing with yum

3.點擊(2)連結找到3.4版本複製

 

4.進入yum倉庫中/etc/yum.repos.d/建立mongodb.repo  檔案

 

     開啟yum倉庫命令 yum

 

     進入檔案 cd /etc/yum.repos.d

 

 建立檔案(不是檔案夾)vi mongodb.repo  

 

 進入編輯模式 a

 

5. 粘貼3.4版本的內容 :w 儲存 :q 退出

 

 安裝 mongodb資料庫:  yum install mongodb*   或 sudo yum install -y mongodb-org

 

補充:查看mongodb安裝是否成功命令chkconfig  可以看到mongod

 

6.在linux下mongodb的簡單操作

 

學習mongodb網址:http://www.runoob.com/mongodb/mongodb-create-database.html

 

 

 

    查看mongodb的運行狀態:service mongod status

 

   開啟mongodb:service mongod start

 

  停止mongodb:service mongod restart

 

  進入mongodb資料庫:mongo

 

 

 

顯示所有的資料庫:show dbs

 

新增或使用那個資料庫ghf:use ghf

 

顯示當前資料庫:db

 

增:向ghf插入資料:db.ghf.insert({"name":"菜鳥教程"})

 

刪:

 

改:

 

查:顯示ghf的全部資料:db.ghf.find()

 

 

在linux下運行mongodb

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.