PostgreSQL 12 起動時にエラー「”/var/lib/pgsql/12/data/” is missing or empty.」が発生した際の対応方法
- 作成日 2020.05.08
- 更新日 2020.07.18
- PostgreSQL
- PostgreSQL 12, エラー

PostgreSQL 12を再起動した際に、エラーが発生して起動ができなかったので、その際に対応方法を記述してます。
環境
- CentOS Linux release 7.7.1908 (Core)
- PostgreSQL 12.2
エラー内容
centos8.localdomain postgresql-12-check-db-dir[22528]: "/var/lib/pgsql/12/data/" is missing or empty.
centos8.localdomain postgresql-12-check-db-dir[22528]: Use "/usr/pgsql-12/bin/postgresql-12-setup initdb" to initialize the database cluster.
centos8.localdomain postgresql-12-check-db-dir[22528]: See /usr/share/doc/postgresql12/README.rpm-dist for more information.
centos8.localdomain systemd[1]: postgresql-12.service: Control process exited, code=exited status=1
centos8.localdomain systemd[1]: postgresql-12.service: Failed with result 'exit-code'.
centos8.localdomain systemd[1]: Failed to start PostgreSQL 12 database server.
原因
ディレクトリ「/var/lib/pgsql」の所有者が変わっていたため発生。
対処法
所有者をpostgresに戻してあげれば、解決されました。
sudo chown -R postgres:postgres /var/lib/pgsql
-
前の記事
Windows10 Sedをインストールして使用する手順 2020.05.08
-
次の記事
Windows10 AdoptOpenJDKをインストールしてjavaを利用する 2020.05.08
コメントを書く