2017-04-26 74 views
0

當我嘗試連接並訪問或啓動PostgreSQL時,出現此錯誤!安裝(PostgreSQL)9.6.2 Sabayon linux?

Sabayon postgresql-9.6 # sudo su -c "createuser --superuser gisuser" postgres 
Createuser: could not connect to database postgres: could not connect to server: File or directory not found 
The server is running locally and accepting 
Connections in the Unix domain socket "/run/postgresql/.s.PGSQL.5432"? 
Sabayon postgresql-9.6 # psql --version 
Psql (PostgreSQL) 9.6.2 

回答

0

這意味着你的Postgres服務器沒有運行。

的步驟啓動服務器:

  1. 創建一個目錄,您的服務器將運行。

    $ mkdir /usr/db/ 
    
  2. 分配的所有權和權限,以/usr/db/

    $ chown postgres:postgres /usr/db/ 
    $ chmod 757 /usr/db/ 
    
  3. 運行終端作爲用戶postgres

    $ su postgres 
    
  4. 運行下面的命令以啓動服務器

    $ initdb -D /usr/db/ 
    $ pg_ctl start -D /usr/db/ 
    
  5. 現在,你的postgres服務器應該正在運行。退出終端作爲用戶postgres,現在你可以使用下面的命令

    $ psql -U postgres 
    
+0

Tanks..Tanks..Tanks..Tanks進入psql終端.. –