首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Mac中找到用于PostgreSQL的数据目录

无法在Mac中找到用于PostgreSQL的数据目录
EN

Stack Overflow用户
提问于 2014-06-10 03:35:59
回答 1查看 3.5K关注 0票数 1

我已经在MacOSX10.9.3中通过自制安装了PostgreSQL 9.3。当我第一次安装它的时候,它运行得很好。在重新启动之后,它碰巧没有启动,我不知道如何由pg_ctl启动它,因为我找不出它的数据目录是什么:

代码语言:javascript
复制
$ pg_ctl start
pg_ctl: no database directory specified and environment variable PGDATA unset
Try "pg_ctl --help" for more information.

$ pwd
/usr/local/var/postgres

$ ls -al
total 96
drwx------  21 alex  admin    714 Jun  2 21:23 .
drwx------   3 alex  admin    102 Jun  1 15:08 ..
-rw-------   1 alex  admin      4 Jun  1 15:08 PG_VERSION
drwx------   6 alex  admin    204 Jun  2 11:40 base
drwx------  42 alex  admin   1428 Jun  2 14:18 global
drwx------   3 alex  admin    102 Jun  1 15:08 pg_clog
-rw-------   1 alex  admin   4465 Jun  2 10:58 pg_hba.conf
-rw-------   1 alex  admin   1636 Jun  1 15:08 pg_ident.conf
drwx------   4 alex  admin    136 Jun  1 15:08 pg_multixact
drwx------   3 alex  admin    102 Jun  1 18:24 pg_notify
drwx------   2 alex  admin     68 Jun  1 15:08 pg_serial
drwx------   2 alex  admin     68 Jun  1 15:08 pg_snapshots
drwx------   7 alex  admin    238 Jun  2 21:23 pg_stat
drwx------   2 alex  admin     68 Jun  2 21:23 pg_stat_tmp
drwx------   3 alex  admin    102 Jun  1 15:08 pg_subtrans
drwx------   2 alex  admin     68 Jun  1 15:08 pg_tblspc
drwx------   2 alex  admin     68 Jun  1 15:08 pg_twophase
drwx------   4 alex  admin    136 Jun  1 15:08 pg_xlog
-rw-------   1 alex  admin  20571 Jun  1 15:08 postgresql.conf
-rw-------   1 alex  admin     79 Jun  1 18:24 postmaster.opts
-rw-------   1 alex  admin   1482 Jun  2 21:23 server.log

/Library中没有什么叫做PostgreSQL之类的东西。

我怎么才能找到呢?

更新

代码语言:javascript
复制
$ sudo chown -R _postgres /usr/local/var/postgres
$ ls -ld /usr/local/var/postgres
drwx------  21 _postgres  admin  714 Jun  2 21:23 /usr/local/var/postgres

#################

$ sudo -u _postgres pg_ctl -D /usr/local/var/postgres -w start
could not identify current directory: Permission denied
pg_ctl: could not open PID file "/usr/local/var/postgres/postmaster.pid": Permission denied

$ ls -al /usr/local/var/postgres/postmaster.pid
ls: /usr/local/var/postgres/postmaster.pid: Permission denied

$ sudo ls -al /usr/local/var/postgres/postmaster.pid
ls: /usr/local/var/postgres/postmaster.pid: No such file or directory
EN

回答 1

Stack Overflow用户

发布于 2014-06-10 04:34:28

pg_ctl不查找当前目录中的数据。您必须使用PGDATA env或-D命令行参数来指定它。

发射:

代码语言:javascript
复制
sudo -u postgres pg_ctl -D /usr/local/var/postgres -w start

但是,您确实应该将其设置为开始使用launchd。AFAIK,这是在家庭文档中涵盖的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24132418

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档