2014-04-29 40 views
0

postgres創造了一個PostgreSQL用戶foo非Linux的postgresql用戶可以創建數據庫嗎?

$ sudo -u postgres createuser -d -P foo 
Enter password for new role: foo 
Enter it again: foo 

foo創建一個數據庫,讓我們說foo

+1

也許嘗試看看.. –

+0

運行'PSQL -U foo'然後運行'創建數據庫' –

回答

2

http://www.postgresql.org/docs/current/static/app-createuser.html

-d --createdb 新用戶將被允許創建數據庫。

所以當你使用了-d參數的用戶foo應該有權限create databases這樣的:

createdb -h localhost -U foo foos_db 
+0

我知道。我使用了這個選項。 'foo'創建數據庫的命令是什麼? – ericj

+0

@ericj http://www.postgresql.org/docs/current/static/app-createdb.html – splash

+0

謝謝,它的工作原理。 – ericj

相關問題