2016-12-26 87 views
0

我正在使用Linux Mint 17.我用apt-get安裝了postgres。我得到了postgres用戶帳戶,我不必創建它。然後我登錄爲Postgres的和遵循這些步驟:爲什麼我不能用postgres做任何事情?

$ initdb -D /usr/local/pgsql/data 
... 
Success. 
You can now start the database server of the Postgres-XC coordinator using: 

    postgres --coordinator -D /usr/local/pgsql/data 
or 
    pg_ctl start -D /usr/local/pgsql/data -Z coordinator -l logfile 

You can now start the database server of the Postgres-XC datanode using: 

    postgres --datanode -D /usr/local/pgsql/data 
or 
    pg_ctl start -D /usr/local/pgsql/data -Z datanode -l logfile 

然後,我發出這兩個命令:

$ pg_ctl start -D /usr/local/pgsql/data -Z coordinator -l logfile 
$ pg_ctl start -D /usr/local/pgsql/data -Z datanode -l logfile 

我沒有得到任何迴應。

然後我嘗試createdb和createuser,但我不能。她可以看到一些信息,我希望它有幫助。

[email protected] ~ $ ps aux | grep postgres 
postgre+ 1332 0.0 0.3 53304 6800 ?  S 07:59 0:00 /usr/bin/postgres --datanode -D /var/lib/postgres-xc/DN1 
postgre+ 1363 0.0 0.3 53304 6808 ?  S 07:59 0:00 /usr/bin/postgres --datanode -D /var/lib/postgres-xc/DN2 
postgre+ 1372 0.0 0.0 53304 1224 ?  Ss 07:59 0:00 postgres: checkpointer process       
postgre+ 1373 0.0 0.0 53304 1456 ?  Ss 07:59 0:00 postgres: writer process         
postgre+ 1374 0.0 0.0 53304 1224 ?  Ss 07:59 0:00 postgres: wal writer process        
postgre+ 1375 0.0 0.1 53724 2220 ?  Ss 07:59 0:00 postgres: autovacuum launcher process     
postgre+ 1376 0.0 0.0 23256 1256 ?  Ss 07:59 0:00 postgres: stats collector process      
postgre+ 1419 0.0 0.0 53304 1232 ?  Ss 07:59 0:00 postgres: checkpointer process       
postgre+ 1420 0.0 0.0 53304 1464 ?  Ss 07:59 0:00 postgres: writer process         
postgre+ 1421 0.0 0.0 53304 1232 ?  Ss 07:59 0:00 postgres: wal writer process        
postgre+ 1423 0.0 0.1 53724 2228 ?  Ss 07:59 0:00 postgres: autovacuum launcher process     
postgre+ 1424 0.0 0.0 23256 1264 ?  Ss 07:59 0:00 postgres: stats collector process      
postgre+ 1440 0.0 0.3 53304 6856 ?  S 07:59 0:00 /usr/bin/postgres --coordinator -D /var/lib/postgres-xc/CN 
postgre+ 1451 0.0 0.0 53304 1224 ?  Ss 07:59 0:00 postgres: pooler process         
postgre+ 1453 0.0 0.0 53304 1712 ?  Ss 07:59 0:00 postgres: checkpointer process        
postgre+ 1454 0.0 0.0 53304 1464 ?  Ss 07:59 0:00 postgres: writer process         
postgre+ 1455 0.0 0.0 53304 1456 ?  Ss 07:59 0:00 postgres: wal writer process        
postgre+ 1456 0.0 0.5 63548 11736 ?  Ss 07:59 0:00 postgres: autovacuum launcher process      
postgre+ 1457 0.0 0.0 23256 1264 ?  Ss 07:59 0:00 postgres: stats collector process       
postgre+ 1481 0.0 0.1 16412 2716 ?  S 07:59 0:00 /usr/bin/gtm -D /var/lib/postgres-xc/GTM -l /var/log/postgres-xc/datanode.log 
darko  8426 0.0 0.0 5908 856 pts/0 S+ 18:34 0:00 grep --colour=auto postgres 
[email protected] ~ $ sudo -u postgres -i 
[sudo] password for darko: 
[email protected] ~ $ createuser darko 
createuser: could not connect to database postgres: FATAL: role "postgres" does not exist 
+0

安裝在_system_上創建了一個postgres用戶來運行集羣,但不是相應的數據庫用戶。它可能創建了一個'darko'用戶,如果那是你安裝軟件包的用戶。從你自己的會話中嘗試'psql',看看是否能讓你獲得任何地方。 – dmfay

+0

我試過了,看看。 – piga

+0

我試過這個:darko @ darko-Lenovo-G570〜$ psql psql:FATAL:角色「darko」不存在 – piga

回答

0

我被混淆角色,數據庫和特權,所以我決定刪除postgresql並重新安裝它。其實我覺得我沒有正確安裝它,因爲第一次安裝是 $ sudo apt-get install postgresql 並且沒有任何工作對我來說,正如我所描述的那樣。所以我決定要殺死所有Postgres處理: $ sudo的pkill的Postgres的 刪除的PostgreSQL $ sudo易於得到,如手動的PostgreSQL-9.6-A4.pdf描述刪除的PostgreSQL 和構建PostgreSQL的形式源(你可以從這裏下載互聯網)。本手冊非常棒,您可以在此找到所有內容。 可能我的一些命令不是100%正確的,因爲我解決了我的問題已經過了幾天。

相關問題