CentOS7にPostgreSQLをインストール
PostgreSQLをインストールと初期設定と起動
# yum install postgresql-server # psql --version
# postgresql-setup initdb # systemctl enable postgresql.service # systemctl start postgresql.service
md5認証に統一
まずはパスワードの変更
# su postgres -c 'psql --username=postgres' postgres=# postgres=# ALTER USER postgres with encrypted password 'パスワード' postgres=# \q
md5認証に統一
# vim /var/lib/pgsql/data/pg_hba.conf
#local all all peer local all all md5 # IPv4 local connections: #host all all 127.0.0.1/32 ident host all all 127.0.0.1/32 md5 # IPv6 local connections: #host all all ::1/128 ident host all all ::1/128 md5
postgresql を再起動
systemctl restart postgresql.service
データベース作成
# createdb sample -U postgres