2017-10-10 8 views
2

Postgres가 openBSD와 어떻게 작동하는지 이해할 수 없습니다. debian (initdb를 할 필요가 없음)에 이러한 문제가 없었습니다.Postgresql과 OpenBSD 최초 연결

pkg_add postgresql-server php-pgsql 
su - _postgresql 
initdb -D /var/postgresql/data -U postgres - E UTF8 -A md5 -W 

그러나 그 후, 나는

내가

pg_ctl -D /var/postgresql/data/ -l logfile start 

또는

와 데이터베이스를 시작할 수 있습니다 기대하는 결과가 없습니다를 따를 때

은 내가 그랬어

rcctl enable postgresql 
rcctl start postgresql 

는 _postgresql 사용자의 왜
# su - _postgresql   
$ psql 
Password: 
psql: FATAL: password authentication failed for user "_postgresql" 

하지가 POSTGRES : 내가 할 경우 있기 때문에

에 연결하는 방법을 이해하지? 어떤 암호를 사용해야합니까?

이가있는 pg_hba.conf입니다, 내가 끝을 변경,

# TYPE DATABASE  USER   ADDRESS     METHOD 
# "local" is for Unix domain socket connections only 
local all    all          trust 
# IPv4 local connections: 
host all    all    127.0.0.1/32    
password 
# IPv6 local connections: 
host all    all    ::1/128     md5 

그래서이와, 내 생각, 내가 로그인있어하지만 난 새로운 probleme이 정말 이해가 안 뭔가가있다

$ pg_ctl -D /var/postgresql/data/ -l logfile stop 
waiting for server to shut down.... done 
server stopped 
$ pg_ctl -D /var/postgresql/data/ -l logfile start 
server starting 
$ psql 
psql: FATAL: role "_postgresql" does not exist 

감사

+0

(unix-) 사용자 이름에 앞선 unde rscore, postgres-username은 그렇지 않습니다. 사용자 이름을 제공하지 않으면 psql은 unix-username을 사용한다고 가정합니다. 'psql -U postgres'는 아마도 당신이 원하는 것을 할 것입니다. – wildplasser

+0

감사합니다 !! 좋아 보인다! 내일 더 보게됩니다. –

답변

2

A가 새 데이터베이스가

무선입니다 만들 그래서 일반적인 경우 사용자

su - _postgresql 


initdb -D /var/postgresql/data -U postgres -k -E UTF8 -A md5 -W 

을 토륨과 암호

시작 데이터베이스를 선택해야

pg_ctl -D /var/postgresql/data/ -l logfile start 

그리고 당신은 쉽게

psql -U postgres 

로 로그인하지만하지 않았다 경우 수 작동, 나는 암호로 실수했다고 생각해.

사용자

su - _postgresql 

은 우선은 ph_hba을 변경해야합니다.나는 그래서이 포스트 그레스 사용자와

psql -U postgres 

를 로그인 할 수 있습니다

pg_ctl -D /var/postgresql/data/ -l logfile start 

으로 데이터베이스를 시작하고 마침내 암호를 변경할 때 너무

# TYPE DATABASE  USER   ADDRESS     METHOD 
# "local" is for Unix domain socket connections only 
local all    all          trust 

을 신뢰 conf의

ALTER USER postgres WITH PASSWORD '123'; 

"잊지 마라."; "마지막에!

변경 위해서는 pg_hba.conf 파일 먼저 내가 암호 ph_hba.conf (또는 어쩌면 MD5)

# TYPE DATABASE  USER   ADDRESS     METHOD 
# "local" is for Unix domain socket connections only 
local all    all         password 

을 변경하고

pg_ctl -D /var/postgresql/data/ -l logfile stop 
pg_ctl -D /var/postgresql/data/ -l logfile start 

를 다시 시작해야 그리고 마지막으로 제대로 로그인 할 수 있습니다.

psql -U postgres