티스토리 뷰

brew 사용해 설치

~ brew install postgresql
==> Pouring postgresql--14.4.monterey.bottle.tar.gz
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
  brew postgresql-upgrade-database

This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /usr/local/var/postgres
For more details, read:
  https://www.postgresql.org/docs/14/app-initdb.html

To restart postgresql after an upgrade:
  brew services restart postgresql
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres
==> Summary
🍺  /usr/local/Cellar/postgresql/14.4: 3,307 files, 44.4MB
==> Running `brew cleanup postgresql`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

DB 초기화하기

~ initdb --locale=C -E UTF-8 /usr/local/var/postgres
The files belonging to this database system will be owned by user "whi".                                                                                                          [13/37]
This user must also own the server process.

initdb: error: invalid locale name "UTF8"
➜  ~ initdb --locale=C -E UTF-8 /usr/local/var/postgres
The files belonging to this database system will be owned by user "whi".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /usr/local/var/postgres ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Tokyo
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    pg_ctl -D /usr/local/var/postgres -l logfile start

접근해보기

~ psql postgres
psql (14.4)
Type "help" for help.

postgres=# SELECT rolname FROM pg_roles;
          rolname
---------------------------
 whi
 pg_database_owner
 pg_read_all_data
 pg_write_all_data
 pg_monitor
 pg_read_all_settings
 pg_read_all_stats
 pg_stat_scan_tables
 pg_read_server_files
 pg_write_server_files
 pg_execute_server_program
 pg_signal_backend
(12 rows)

위에서 whi 는 mac 계정

pgAdmin4 설치

~ brew install --cask pgadmin4

접근시 host 는 localhost, Username 과 Role 은 로그인되어있는 맥 계정, Password 는 없다.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함