鍍金池/ 問(wèn)答/數(shù)據(jù)庫(kù)/ mongodb開(kāi)啟鑒權(quán)之后,不輸入密碼賬號(hào)依然可以執(zhí)行數(shù)據(jù)庫(kù)操作。

mongodb開(kāi)啟鑒權(quán)之后,不輸入密碼賬號(hào)依然可以執(zhí)行數(shù)據(jù)庫(kù)操作。

mongodb開(kāi)啟鑒權(quán)之后,只有第一次需要輸入用戶名密碼,之后關(guān)閉服務(wù)重新開(kāi)啟,執(zhí)行數(shù)據(jù)庫(kù)操作就不需要輸入用戶名密碼了。應(yīng)該如何解決呢?
謝謝~

回答
編輯回答
荒城

mongodb服務(wù)器還需要在啟動(dòng)時(shí)加一個(gè)auth參數(shù),文檔中這樣寫(xiě)

Run the database (mongod process) with the --auth option to enable security. You must either have added a user to the admin db before starting the server with --auth, or add the first user from the localhost interface.

我也覺(jué)得這個(gè)設(shè)計(jì)很奇怪,為啥不直接缺省帶上呢。

2018年5月2日 08:01