■ はじめに
https://dk521123.hatenablog.com/entry/2015/04/07/001057
の続き。
目次
【1】Fail「Permission should be u=rwx(0700)」が表示される 【2】「Peer authentication failed for user "XXX"」が表示される 【3】「cannot drop the currently open database」が表示される
【1】Fail「Permission should be u=rwx(0700)」が表示される
現象
* 「service postgresql start」で、 PostgreSQL を開始しようとしたら、 以下のエラー内容が出て、開始できない。
エラー内容
[...] Starting PostgreSQL X.X data server main [...] The PostgreSQL server failed to start. Please check logout: 20XX-XX-XX XX:XX:XX PDT FATAL: data directory "/var/lib/postgresql/X.X/main" has group or world access : Permission should be u=rwx(0700) failed!
原因
「chmod -R 777 /var/lib/postgresql/X.X/main」で 「/var/lib/postgresql/X.X/main」のフルアクセスさせてしまったから。
解決策
chmod -R 700 /var/lib/postgresql/X.X/main
【2】「Peer authentication failed for user "XXX"」が表示される
現象
* PostgreSQLのデーモンを起動しようとした時に、以下の「エラー内容」が表示される
エラー内容
Peer authentication failed for user "XXX" * XXX : ユーザ名
解決策
* 「pg_bha.conf」を以下のように修正する
【修正前】
local all xxxxxxx peer
【修正後】
local all xxxxxxx md5
Debian7の場合
=> /etc/postgresql/9.1/pg_bha.conf
【3】「cannot drop the currently open database」が表示される
現象
* PostgreSQLで、DROP DATABASE を行った際に以下のエラーが発生した
エラー内容
PSQLException: ERROR: cannot drop the currently open database
解決策
* 「DROPDB 【データベース】」を行う
参考文献
http://stackoverflow.com/questions/7073773/drop-postgresql-database-through-command-line
関連記事
PostgreSQLに関するトラブル ~ その1 ~
https://dk521123.hatenablog.com/entry/2015/04/07/001057
PostgreSQLに関するトラブル ~ その3 ~
https://dk521123.hatenablog.com/entry/2021/02/13/000000