2012-09-28 144 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.