psqlの"-U"コマンドが効くようにする
そういえば二年ぐらい前に挑戦して一度挫折したので再挑戦。
具体的には
psql -l -U postgres をすると
”psql: FATAL: IDENT authentication failed for user "postgres"”となる件を解決してみる
# cd /etc/postgresql/8.3/main // バックアップを取って # cp -a pg_hba.conf pg_hba.conf.bak // 書き換える # vi pg_hba.conf // 変更箇所はident sameuser というところ # diff pg_hba.conf.bak pg_hba.conf // ident sameuser を trust (すべて信頼に変更。) // セキュリティ的にどうなのとかはとりあえず気にしない 74c74,75 < local all postgres ident sameuser --- > #local all postgres ident sameuser > local all postgres trust 79c80,81 < local all all ident sameuser --- > #local all all ident sameuser > local all all trust // データベース上のパスワードも変更しておく # su - postgres $ psql template1 template1=# alter user postgres with encrypted password 'password';//ここは任意のパスワード ALTER USER template1=# \q $ exit //postgres再起動 // pg_ctlは以下の通りパスが通ってないのでサービスから再起動する。 // Ubuntu で PostgreSQL を使ってみよう(続編) ― Let's Postgres // http://lets.postgresql.jp/documents/tutorial/ubuntu/4 # /etc/init.d/postgresql-8.3 restart # psql -l -U postgres List of databases Name | Owner | Encoding -----------+----------+---------- postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 testdb | postgres | UTF8 (4 rows)
とりあえずできた!trustの変更も一箇所でいいのかも。
それはまたやってみるということで。
psql:FATAL:Ident authentication failed for user | 作業日報
http://tomo.ac/goodstream/database/postgresql/linux/tips/userauth2.htm
うわ、もう3時だ。寝ないとやばい!