標籤:
一、情境
安裝postgresql時可能因為配置有問題【後來定位問題是我把pg_hba.conf中local一欄的ident修改為peer就會出錯】導致服務起不來,報錯如下:
[[email protected] ~]# /etc/init.d/postgresql restartStopping postgresql service: [ OK ]Starting postgresql service: [FAILED]
所以我使用yum remove和yum install重新安裝postgresql-server。
安裝完成後執行命令# service postgresql initdb報錯如下:
[[email protected] ~]# service postgresql initdbData directory is not empty! [FAILED]
二、解決辦法
網上說這條命令只能執行一次,不需要執行第二次。說了等於沒說。
再看一下錯誤資訊,Data目錄非空。
我的辦法是
[[email protected] ~]# cd /var/lib/pgsql[[email protected] ~]# move data datatemp
然後再次執行執行# service postgresql initdb OK。
[[email protected] pgsql]# lsbackups data datatemp pgstartup.log
然後我再起服務也OK。
[[email protected] ~]# /etc/init.d/postgresql startStarting postgresql service: [ OK ]
本文作者starof,因知識本身在變化,作者也在不斷學習成長,文章內容也不定時更新,為避免誤導讀者,方便追根溯源,請諸位轉載註明出處:http://www.cnblogs.com/starof/p/4773364.html有問題歡迎與我討論,共同進步。
service postgresql initdb [FAILED]