PostgreSQL 啟動失敗解決方法:has group or world access


PostgreSQL 啟動失敗解決

機房斷電了,PostgreSQL 起不起來了。

[root@scoder19 9.3]# service postgresql-9.3 start
Starting postgresql-9.3 service: [FAILED]

日志文件(/var/lib/pgsql/9.3/pgstartup.log):報錯如下:

< 2016-07-11 18:12:54.861 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:12:54.861 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:42:30.144 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:42:30.144 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:48:57.110 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:48:57.110 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:50:03.962 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:50:03.962 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:50:53.958 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:50:53.958 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:53:52.351 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:53:52.351 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 18:56:00.421 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 18:56:00.421 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 19:07:15.219 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 19:07:15.219 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 19:09:04.421 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 19:09:04.421 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 19:27:05.271 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 19:27:05.271 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 20:03:10.555 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access
< 2016-07-11 20:03:10.555 CST >DETAIL:  Permissions should be u=rwx (0700).
< 2016-07-11 20:11:01.442 CST >FATAL:  data directory "/var/lib/pgsql/9.3/data" has group or world access

 

原因是應該是 文件夾 “/var/lib/pgsql/9.3/data”權限錯誤, 權限應該是 rwx (0700)。

解決方法:

切換到 具有root權限的用戶,
(1)先把文件夾 “/var/lib/pgsql/9.3/data” 的用戶所屬組,給postgres 用戶:

進入/var/lib/pgsql/9.3目錄
cd /var/lib/pgsql/9.3
chown -R postgres:postgres data

(2)把data目前的所有文件及子目錄文件權限改成: rwx (0700)

chmod -R 0700 data

重啟PostgreSQL 數據庫,問題解決。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM