LoginSignup
1
0

More than 5 years have passed since last update.

Postgresql on CentOS7

Last updated at Posted at 2017-04-05

普段MariaDB使ってる自分用の備忘録用なので、詳細な解説は省略しています。

環境はCentOS7.3 Postgresql9.2

インストール

yumからインストール

$ sudo yum install postgresql-server -y

db初期化

$ sudo postgresql-setup initdb

anyhost

$ sudo vi /var/lib/pgsql/data/postgresql.conf

デフォルトはlocalhost

listen_addresses = '*'

サーバー起動

$ sudo systemctl start postgresql

※これが出るときは初期化忘れてたりするかも。

Apr  5 14:17:03 localhost postgresql-check-db-dir: "/var/lib/pgsql/data" is missing or empty.
Apr  5 14:17:03 localhost postgresql-check-db-dir: Use "postgresql-setup initdb" to initialize the database cluster.

PSQL

postgresユーザー(初期ユーザー)パスワード設定

※本番環境では設定しないほうが良い?
基本OSユーザーなので、passwdで変更。

$ sudo passwd postgres

postgresuserでpsqlコマンド実行

$ psql
1
0
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
0