service postgresql initdb [FAILED]

來源:互聯網
上載者:User

標籤:

一、情境

安裝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]

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.