Centos6.5安裝配置MongoDB資料庫
阿新 • • 發佈:2018-12-09
概要:安裝MongoDB資料庫分為以下幾步
- 配置MongoDB官方源
- 安裝MongoDB資料庫並啟動
- 簡單使用MongoDB資料庫
一:配置MongoDB官方源
新建一個檔案
/etc/yum.repos.d/mongodb-org-3.4.repo
在檔案中填入以下程式碼
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4 .asc
二:安裝資料庫並啟動
yum install -y mongodb-org
安裝完畢。
啟動資料庫
service mongod start //開啟
service mongod stop //關掉
三:檢視你的資料庫 開啟mongo shell: 進入/usr/bin, 輸入
mongo
會出現以下介面,代表已經進入shell介面
show dbs
use db_name //轉到某個資料庫
show collections //顯示一個db中的collections
db.collection_name.find() //顯示所有條目
教程結束,謝謝~