Mac下mongodb connect failed 串連錯誤解決方案

來源:互聯網
上載者:User

標籤:check   搜尋   解決方案   ict   ref   資料   read   顯示   warnings   

這幾天一直在折騰mongodb資料庫,一直出現如下這個問題

MongoDB shell version v3.6.0connecting to: mongodb://127.0.0.1:270172017-12-27T09:54:34.775+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused2017-12-27T09:54:34.778+0800 E QUERY [thread1] Error: couldn‘t connect to server 127.0.0.1:27017, connection attempt failed :[email protected]/mongo/shell/mongo.js:237:13@(connect):1:6exception: connect failed

嘗試各種方法都不行

當mongodb service 沒有啟動並執行時候會發生這樣的錯誤

嘗試了建立一個/data/db 目錄,也不奏效。

後來通過搜尋,尋找到來解決方案,運行命令

brew services start mongodb

再去調用資料庫命令

mongo

就可以完美解決問題了

最終mac下顯示成功的提示

MongoDB shell version v3.6.0connecting to: mongodb://127.0.0.1:27017MongoDB server version: 3.6.0Server has startup warnings: 2017-12-27T09:54:58.316+0800 I CONTROL  [initandlisten] 2017-12-27T09:54:58.316+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.2017-12-27T09:54:58.316+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.2017-12-27T09:54:58.316+0800 I CONTROL  [initandlisten] > 

 

Mac下mongodb connect failed 串連錯誤解決方案

聯繫我們

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