1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

開発環境に PostgreSQL インストール

Posted at

セキュリティ等考慮されていないので注意

参考: CentOS 7 : PostgreSQL : インストール : Server World

インストール&セットアップ

$ sudo yum install postgresql-server

$ sudo postgresql-setup initdb

起動

$ sudo systemctl start postgresql

状態確認

$ sudo systemctl status postgresql

設定ファイル

/var/lib/pgsql/data/pg_hba.conf を開き 以下のように trust を設定(ローカル開発用のためtrust 公開されているサーバでこれやっちゃダメ)

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

参考 http://www.dbonline.jp/postgresql/ini/index2.html

変更したら再起動

$ sudo systemctl restart postgresql

接続

$ psql -h localhost -p 5432 -U postgres

で接続できたらOK

停止

$ sudo systemctl stop postgresql
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?