溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

mac環(huán)境下mongodb無法啟動(dòng)怎么辦

發(fā)布時(shí)間:2020-06-30 10:56:05 來源:億速云 閱讀:621 作者:清晨 欄目:編程語言

這篇文章主要介紹mac環(huán)境下mongodb無法啟動(dòng)怎么辦,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

解決方法1

原因:mongodb沒有啟動(dòng)

用brew service來啟動(dòng)

brew services start mongodb

解決方法2

原因:沒有db文件夾

Before you start MongoDB for the first time, create the directory to which the mongod process will 
write data. By default, the mongod process uses the /data/db directory. If you create a directory other
than this one, you must specify that directory in the dbpath option when starting the mongod process
later in this procedure.
1. 創(chuàng)建文件夾
mkdir -p /data/db
2. 給文件夾設(shè)置可寫
sudo chown -R `id -un` /data/db
3. 運(yùn)行mongodb
cd /usr/local/mongodb/bin
mongod
mongo
4. 結(jié)束運(yùn)行mongodb
Control+C

解決方法3

原因:因意外造成Mongodb服務(wù)非正常關(guān)閉且造成Mongod服務(wù)無法正常啟動(dòng)

刪除data目錄下的*.lock文件

sudo rm /data/db/mongod.lock
sudo rm /data/db/WiredTiger.lock
然后再啟動(dòng)Mongod服務(wù)
cd /usr/local/mongodb/bin
mongod
mongo
如果還是不行,可以查看一下進(jìn)程,然后殺掉:
ps -aef | grep mongo 
kill ***
cd /usr/local/mongodb/bin
mongod
mongo

解決方法4

原因:Permission denied

cd /usr/local/mongodb/bin
sudo mongod

以上是mac環(huán)境下mongodb無法啟動(dòng)怎么辦的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI