2011-04-20 28 views
13

嗯,我在我的Windows安裝了最新的postgreql數據庫中創建數據庫7PostgreSQL的

現在我想通過psql.exe命令行來創建數據庫

當我打開它,它說

psql: FATAL: database "Jansu" does not exist 

所以我讀了一個地方,當沒有指定數據庫時,它試圖用我的用戶名或其他東西來查找數據庫。

無論如何,當我無法訪問命令行時,我會創建一個新的數據庫。

回答

26

閱讀psql syntax。您可以指定數據庫,用戶和其他參數。如果是新安裝,則應該有一個默認數據庫「postgres」,您可以連接到該數據庫。

psql -U postgres postgres 

(在UNIX環境中,你可能需要以迫使TCP連接添加-h localhost,否則它會嘗試使用Unix域套接字,這可能對於比postgres用戶的其他工作。)

你可以從那裏,或從createdb

+1

psql的命令行創建數據庫:FATAL:身份認證失敗,用戶 「Postgres的」 – 2013-02-20 20:55:00

+1

PSQL:FATAL:對等身份驗證失敗,用戶 「Postgres的」 – Cody 2013-04-01 02:48:04

+0

HTTP:// stackoverflow.com/questions/2942485/psql-fatal-ident-authenticati on-failed-for-user-postgres @Cody http://stackoverflow.com/questions/11913897/postgres-whats-the-difference-between-local-and-localhost-connection-type – leonbloy 2013-04-01 12:58:24