1. ์ค๋ฅ ๋ฐ์
PostgreSQL์ ์ค์น ํ์ ์ฝ์๋ก ์ ์ํ๋ ค๊ณ ํ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅ ํ๋ผ๊ณ ๋์๊ณ
๋ด ๋ ธํธ๋ถ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅ ํ์๋๋ failed: FATAL: password authentication failed for user ์๋ฌ๊ฐ ๋์๋ค.
โ ~ git:(main) โ psql postgres
Password for user username:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "username"

๊ตฌ๊ธ๋ง์ ํด๋ณด๋ค๊ฐ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค๋ ๋ธ๋ก๊ทธ ๊ธ์ ๋ฐ๊ฒฌํ๋ค.
https://dev-edward.tistory.com/11
2. ํด๊ฒฐ ๋ฐฉ๋ฒ -> ์ญ์ ํ ์ฌ์ค์น -> ํด๊ฒฐ ์๋จ
password ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ์๋
์์คํ ํ๊ฒฝ์ค์ -> ์ฌ์ฉ์ ๋ฐ ๊ทธ๋ฃน -> ์ ๊ธ ํด์ -> PostgreSQL -> ์ํธ ์ฌ์ค์ ์ผ๋ก ๋ก๊ทธ์ธ ํ ์ ์๋ค๊ณ ํ๋๋ฐ
๋๋ ๋ก๊ทธ์ธ ํญ๋ชฉ์์ PostgreSQL๋ฅผ ์ฐพ์ ์ ์์ด์
๋ญ๊ฐ ์ค์น ๊ฒฝ๋ก๊ฐ ์๋ชป ๋ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์
์ญ์ ํ๊ณ ๋ค์ ์ค์นํด์ฃผ๊ธฐ๋ก ํ๋ค ..
3. ์ญ์ ๋ฐฉ๋ฒ
3.1. ์๋ฒ ์ข ๋ฃ
brew services stop postgresql
3.2. ์ค์น์ญ์
brew uninstall --force postgresql
3.3. postresql ๊ฒฝ๋ก ์ด๋ ํ ์ญ์
cd /opt/homebrew/var
rm -rf /usr/local/var/postgresql
3.4. ์ญ์ ํ์ธ
brew cleanup
brew list | grep sql
postgresql ์ด ๋จ์ง ์์ผ๋ฉด ์ญ์ ์๋ฃ ๋ ๊ฒ์ด๋ค.

4. ํด๊ฒฐ ๋ฐฉ๋ฒ ์ฐพ๋ ์ค
Application ์๋์์ brew๋ก ๋ค์ ์ค์น ํด์ฃผ์๋๋ฐ ๋๊ฐ์ ์ค๋ฅ๊ฐ ๋์
๋ ๊ตฌ๊ธ๋ง ํด๋ดค๋ค.
https://kth990303.tistory.com/422
[PostgreSQL] Mac M1 Postgres ์คํ ์๋ฌ ํด๊ฒฐ_ Failure while executing; `/bin/launchctl bootstrap gui/501 /Library/LaunchAge
์ค๋๋ง์ ์๋ ๋ช ๋ น์ด๋ก PostgreSQL๋ฅผ ์คํํ๋ ค๋๋ฐ ์๋ ์๋ฌ๋ฅผ ๋ง๋ฌ๋ค. Postgresql ์คํ ์ brew services start postgresql@14 Bootstrap failed: 5: Input/output error Try re-running the command as root for richer errors. Error: Failu
kth990303.tistory.com
Mac M1์ var ํด๋๊ฐ `/usr/bin`์ด ์๋ `/opt/homebrew`์ ์๋ค๋ ์ !!!!
๋๋ ์ ์์ง ..
์ค์น๋ ์ ๋๋ก ๋์ด์๋ ๊ฒ ๊ฐ์๋ฐ ..

์ด๊ฑฐ ๋ณด๋ฉด cd /opt/homebrew/var/postgresql@14 pg_hba.conf ์ค์ ํ์ผ์์
๋ญ๊ฐ ํ ์ ์์ ๊ฒ ๊ฐ์๋ฐ ๋๋ ์์ ์ postgresql์ด ์๋ค. ๐ข
https://goddessbest-qa.tistory.com/278
postgresql ์ค์น์ ์ค์ (install & setting) for Mac
๋ฌด๋ฃ ์คํ์์ค์ธ postgresql ์ ์ค์น์ ์ค์ ๋ฒ์ ๋๋ค. ์ ๋ mysql๊ณผ mongoDB๋ ์ฌ์ฉํด๋ดค๋๋ฐ postgresql์ ์ฒ์ ์ฌ์ฉํด๋ด์ ๊ณผ์ ์ ๋ฆฌ ๊ฒธ ๋ค์ํ๋ฒ ๊ณผ์ ์ ๊ณฑ์น์ด๋ณด๋ ํฌ์คํ ์ ๋๋ค ใ ใ ์ด๋ฒ์ ํ ์คํธ
goddessbest-qa.tistory.com
+
!!!
pg_hba.conf ํ์ผ์ ๋ฐ๊ฒฌํ๋ค.

brew ๋ก postgresql ์ค์น ํ ์ํธ ์ค์ ํ๊ธฐ ํค์๋๋ก ๊ตฌ๊ธ๋ง์ ๋ค์ ํด๋ณด๋ ์ค์ ์๋ ๊ธ์ ๋ฐ๊ฒฌํ์๋ค.
brew ๋ก postgresql ์ค์น ํ ์ ์์ ์ํธ(pw) ๋ฌป์ง ์๋ ์
`/opt/homebrew` ์๋๊ฐ ์๋๋ผ '/usr/local/var/' ์๋์ ์์๊น ..?
+
๋ค๋ฅธ ์ค์น ๊ธ์ ๋ณด๋ฉด
psql postgres ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ๋ฉด ๋ฐ๋ก ๋น๋ฐ๋ฒํธ ์ ๋ ฅ ์์ด ์ฝ์๋ก ๋ค์ด๊ฐ์ง๋๋ฐ
๋๋ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ผ๊ณ ๋์ฌ๊น?
ํน์ ๊ณผ๊ฑฐ์ ๋ด๊ฐ User๋ฅผ ์์ฑํ ์ ์ด ์๋ ๊ฑธ๊น?
https://postgresql.kr/docs/9.5/client-authentication-problems.html
์ธ์ฆ ๋ฌธ์
์ธ์ฆ ์คํจ ๋ฐ ๊ด๋ จ ๋ฌธ์ ๋ ์ผ๋ฐ์ ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ ์๋ฌ ๋ฉ์์ง๋ฅผ ํตํด ๋๋ฌ๋๋ค. FATAL: no pg_hba.conf entry for host "123.123.123.123", user "andym", database "testdb" ์ด๊ฒ์ ์ฌ์ฉ์๊ฐ ์๋ฒ์์ ์ ์ด์ ์ฑ๊ณตํ์
postgresql.kr
FATAL: password authentication failed for user "andym"
์ด ๋ฉ์์ง๋ ์ฌ์ฉ์๊ฐ ์๋ฒ์ ์ ์ดํ์ผ๋ฉฐ, ํต์ ์ ๊ฐ๋ฅํ์ง๋ง pg_hba.conf ํ์ผ์ ์ง์ ๋ ์ธ์ฆ ๋ฐฉ๋ฒ์ ํต๊ณผํด์ผ ํจ์ ์๋ฏธํ๋ค.
์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ํจ์ค์๋๋ฅผ ๊ฒ์ฌํ๊ฑฐ๋, ์ด๋ฌํ ์ธ์ฆ ์ ํ์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒฝ์ฐ์ ์ฌ์ฉ์์ Kerberos ๋๋ ident ์ํํธ์จ์ด๋ฅผ ๊ฒ์ฌํด์ผ ํ๋ค.
pg_hba.conf ํ์ผ์ ์ด์ด๋ณด๋ METHOD ๋ชจ๋ trust๋ก ๋์ด์๋๋ฐ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ผ๊ณ ํ๋๊ฑฐ์ผ ...

5. ์์์์์
ํ 10๋ฒ ๋๊ฒ ์ญ์ ํ๊ณ ์ค์น ํ ๊ฒ ๊ฐ๋ค
๋ง์ง๋ง์ด๋ค ์๊ฐํ๊ณ ์ด ๋ธ๋ก๊ทธ ๊ธ์ ๋ฐ๋ผ ํ๋ค.
์ฐ์ ์ญ์ ํ๊ณ ์ญ์ ์๋ฃ ๋ ๊ฒ ๊น์ง ํ์ธ

์ค์นํ ๋ ๋ฒ์ ์ ํ์ํด์ฃผ๊ธฐ
brew install postgresql@14
๊ทธ๋๋ ๋๊ฐ์ ์ค๋ฅ๊ฐ ๋์จ๋ค ..
'๐ ์ด๊ฒ์ ๊ฒ > ์ค๋ฅ ๋ชจ์' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
1. ์ค๋ฅ ๋ฐ์
PostgreSQL์ ์ค์น ํ์ ์ฝ์๋ก ์ ์ํ๋ ค๊ณ ํ๋ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅ ํ๋ผ๊ณ ๋์๊ณ
๋ด ๋ ธํธ๋ถ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅ ํ์๋๋ failed: FATAL: password authentication failed for user ์๋ฌ๊ฐ ๋์๋ค.
โ ~ git:(main) โ psql postgres
Password for user username:
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: password authentication failed for user "username"

๊ตฌ๊ธ๋ง์ ํด๋ณด๋ค๊ฐ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค๋ ๋ธ๋ก๊ทธ ๊ธ์ ๋ฐ๊ฒฌํ๋ค.
https://dev-edward.tistory.com/11
2. ํด๊ฒฐ ๋ฐฉ๋ฒ -> ์ญ์ ํ ์ฌ์ค์น -> ํด๊ฒฐ ์๋จ
password ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ์๋
์์คํ ํ๊ฒฝ์ค์ -> ์ฌ์ฉ์ ๋ฐ ๊ทธ๋ฃน -> ์ ๊ธ ํด์ -> PostgreSQL -> ์ํธ ์ฌ์ค์ ์ผ๋ก ๋ก๊ทธ์ธ ํ ์ ์๋ค๊ณ ํ๋๋ฐ
๋๋ ๋ก๊ทธ์ธ ํญ๋ชฉ์์ PostgreSQL๋ฅผ ์ฐพ์ ์ ์์ด์
๋ญ๊ฐ ์ค์น ๊ฒฝ๋ก๊ฐ ์๋ชป ๋ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์
์ญ์ ํ๊ณ ๋ค์ ์ค์นํด์ฃผ๊ธฐ๋ก ํ๋ค ..
3. ์ญ์ ๋ฐฉ๋ฒ
3.1. ์๋ฒ ์ข ๋ฃ
brew services stop postgresql
3.2. ์ค์น์ญ์
brew uninstall --force postgresql
3.3. postresql ๊ฒฝ๋ก ์ด๋ ํ ์ญ์
cd /opt/homebrew/var
rm -rf /usr/local/var/postgresql
3.4. ์ญ์ ํ์ธ
brew cleanup
brew list | grep sql
postgresql ์ด ๋จ์ง ์์ผ๋ฉด ์ญ์ ์๋ฃ ๋ ๊ฒ์ด๋ค.

4. ํด๊ฒฐ ๋ฐฉ๋ฒ ์ฐพ๋ ์ค
Application ์๋์์ brew๋ก ๋ค์ ์ค์น ํด์ฃผ์๋๋ฐ ๋๊ฐ์ ์ค๋ฅ๊ฐ ๋์
๋ ๊ตฌ๊ธ๋ง ํด๋ดค๋ค.
https://kth990303.tistory.com/422
[PostgreSQL] Mac M1 Postgres ์คํ ์๋ฌ ํด๊ฒฐ_ Failure while executing; `/bin/launchctl bootstrap gui/501 /Library/LaunchAge
์ค๋๋ง์ ์๋ ๋ช ๋ น์ด๋ก PostgreSQL๋ฅผ ์คํํ๋ ค๋๋ฐ ์๋ ์๋ฌ๋ฅผ ๋ง๋ฌ๋ค. Postgresql ์คํ ์ brew services start postgresql@14 Bootstrap failed: 5: Input/output error Try re-running the command as root for richer errors. Error: Failu
kth990303.tistory.com
Mac M1์ var ํด๋๊ฐ `/usr/bin`์ด ์๋ `/opt/homebrew`์ ์๋ค๋ ์ !!!!
๋๋ ์ ์์ง ..
์ค์น๋ ์ ๋๋ก ๋์ด์๋ ๊ฒ ๊ฐ์๋ฐ ..

์ด๊ฑฐ ๋ณด๋ฉด cd /opt/homebrew/var/postgresql@14 pg_hba.conf ์ค์ ํ์ผ์์
๋ญ๊ฐ ํ ์ ์์ ๊ฒ ๊ฐ์๋ฐ ๋๋ ์์ ์ postgresql์ด ์๋ค. ๐ข
https://goddessbest-qa.tistory.com/278
postgresql ์ค์น์ ์ค์ (install & setting) for Mac
๋ฌด๋ฃ ์คํ์์ค์ธ postgresql ์ ์ค์น์ ์ค์ ๋ฒ์ ๋๋ค. ์ ๋ mysql๊ณผ mongoDB๋ ์ฌ์ฉํด๋ดค๋๋ฐ postgresql์ ์ฒ์ ์ฌ์ฉํด๋ด์ ๊ณผ์ ์ ๋ฆฌ ๊ฒธ ๋ค์ํ๋ฒ ๊ณผ์ ์ ๊ณฑ์น์ด๋ณด๋ ํฌ์คํ ์ ๋๋ค ใ ใ ์ด๋ฒ์ ํ ์คํธ
goddessbest-qa.tistory.com
+
!!!
pg_hba.conf ํ์ผ์ ๋ฐ๊ฒฌํ๋ค.

brew ๋ก postgresql ์ค์น ํ ์ํธ ์ค์ ํ๊ธฐ ํค์๋๋ก ๊ตฌ๊ธ๋ง์ ๋ค์ ํด๋ณด๋ ์ค์ ์๋ ๊ธ์ ๋ฐ๊ฒฌํ์๋ค.
brew ๋ก postgresql ์ค์น ํ ์ ์์ ์ํธ(pw) ๋ฌป์ง ์๋ ์
`/opt/homebrew` ์๋๊ฐ ์๋๋ผ '/usr/local/var/' ์๋์ ์์๊น ..?
+
๋ค๋ฅธ ์ค์น ๊ธ์ ๋ณด๋ฉด
psql postgres ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ๋ฉด ๋ฐ๋ก ๋น๋ฐ๋ฒํธ ์ ๋ ฅ ์์ด ์ฝ์๋ก ๋ค์ด๊ฐ์ง๋๋ฐ
๋๋ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ผ๊ณ ๋์ฌ๊น?
ํน์ ๊ณผ๊ฑฐ์ ๋ด๊ฐ User๋ฅผ ์์ฑํ ์ ์ด ์๋ ๊ฑธ๊น?
https://postgresql.kr/docs/9.5/client-authentication-problems.html
์ธ์ฆ ๋ฌธ์
์ธ์ฆ ์คํจ ๋ฐ ๊ด๋ จ ๋ฌธ์ ๋ ์ผ๋ฐ์ ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ ์๋ฌ ๋ฉ์์ง๋ฅผ ํตํด ๋๋ฌ๋๋ค. FATAL: no pg_hba.conf entry for host "123.123.123.123", user "andym", database "testdb" ์ด๊ฒ์ ์ฌ์ฉ์๊ฐ ์๋ฒ์์ ์ ์ด์ ์ฑ๊ณตํ์
postgresql.kr
FATAL: password authentication failed for user "andym"
์ด ๋ฉ์์ง๋ ์ฌ์ฉ์๊ฐ ์๋ฒ์ ์ ์ดํ์ผ๋ฉฐ, ํต์ ์ ๊ฐ๋ฅํ์ง๋ง pg_hba.conf ํ์ผ์ ์ง์ ๋ ์ธ์ฆ ๋ฐฉ๋ฒ์ ํต๊ณผํด์ผ ํจ์ ์๋ฏธํ๋ค.
์ฌ์ฉ์๊ฐ ์ ๋ ฅํ ํจ์ค์๋๋ฅผ ๊ฒ์ฌํ๊ฑฐ๋, ์ด๋ฌํ ์ธ์ฆ ์ ํ์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒฝ์ฐ์ ์ฌ์ฉ์์ Kerberos ๋๋ ident ์ํํธ์จ์ด๋ฅผ ๊ฒ์ฌํด์ผ ํ๋ค.
pg_hba.conf ํ์ผ์ ์ด์ด๋ณด๋ METHOD ๋ชจ๋ trust๋ก ๋์ด์๋๋ฐ ์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ๋ผ๊ณ ํ๋๊ฑฐ์ผ ...

5. ์์์์์
ํ 10๋ฒ ๋๊ฒ ์ญ์ ํ๊ณ ์ค์น ํ ๊ฒ ๊ฐ๋ค
๋ง์ง๋ง์ด๋ค ์๊ฐํ๊ณ ์ด ๋ธ๋ก๊ทธ ๊ธ์ ๋ฐ๋ผ ํ๋ค.
์ฐ์ ์ญ์ ํ๊ณ ์ญ์ ์๋ฃ ๋ ๊ฒ ๊น์ง ํ์ธ

์ค์นํ ๋ ๋ฒ์ ์ ํ์ํด์ฃผ๊ธฐ
brew install postgresql@14
๊ทธ๋๋ ๋๊ฐ์ ์ค๋ฅ๊ฐ ๋์จ๋ค ..