2012-09-28 141 views
1

試圖使用postgres刪除數據庫,但我得到的dropdb: could not connect to database postgres: FATAL: Ident authentication failed for user "root".命令我使用的是「dropdb databasename」。請建議無法刪除數據庫

+4

不這樣做的根源。做爲數據庫管理員用戶。它最有可能命名爲postgres。 –

回答

-2

標準的方式來做到這一點是

DROP DATABASE [IF EXISTS] nameDB

+1

用戶試圖做的事情也是如此 – Karlson

5

定期(例如在Debian或Ubuntu)的系統用戶root沒有特權爲數據庫用戶

您的錯誤消息表明您正試圖刪除數據庫爲系統用戶root。相反,跟系統用戶postgres相同的 - 或與任何系統用戶connect特權來維護數據庫(默認情況下也被稱爲postgres)和相關的數據庫用戶有必要的權限刪除數據庫有問題。

sudo -u postgres dropdb databasename 

More details in the manual on dropdb.