MONGO DB windows 安裝,mongodb

來源:互聯網
上載者:User

MONGO DB windows 安裝,mongodb
1,下載安裝包
https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.0-signed.msi?_ga=1.22066811.1599532380.1422017396
下載完成後,把安裝檔案放置到你要安裝的目錄下面。
2,執行安裝
用win+r開啟運行框,輸入“cmd”運行。(要以管理員的方式運行)把目錄切換到安裝的目錄,執行下面的命令。
msiexec.exe /q /i mongodb-win32-x86_64-2008plus-ssl-3.0.0-signed.msi INSTALLLOCATION="安裝目錄" ADDLOCAL=MonitoringTools,ImportExportTools,MiscellaneousTools
或者
msiexec.exe /q /i mongodb-win32-x86_64-2008plus-ssl-3.0.0-signed.msi INSTALLLOCATION="安裝目錄" ADDLOCAL=ALL
ps: ADDLOCAL後面添加的參數是你要安裝的服務。
3,建立資料庫
使用命令 md \data\db 建立目錄
建立初始資料庫mongod.exe --dbpath 安裝目錄\data


4,把mongodb註冊成windows服務
使用命令在安裝目錄下建立日誌目錄  md \data\log
建立一個設定檔,把資料庫目錄、日誌目錄配置寫入檔案中
echo logpath=安裝目錄\data\log\mongod.log> "C:\mongodb\mongod.cfg"
echo dbpath=安裝目錄\data\db>> "C:\mongodb\mongod.cfg"
建立MongoDB服務
sc.exe create MongoDB binPath= "\"安裝目錄\bin\mongod.exe\" --service --config=\"安裝目錄\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
建立成功會顯示以下資訊
[SC] CreateService SUCCESS
 
Start the MongoDB service.
net start MongoDB


5,啟動,停止,刪除mongodb服務(要在管理下面執行)
啟動服務
net start MongoDB
停止服務
net stop MongoDB
移除服務
sc.exe delete MongoDB
6,測試安裝是否成功
進行安裝目錄下面的bin目錄下面

執行如下



看到上面的資訊說明安裝成功!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.