How to resolve this PostgreSQL error on OS 10.6 (Snow Leopard)

旧城冷巷雨未停 提交于 2019-12-06 11:32:18

I had to remove the existing postgres user before doing the install.

Perhaps you moved your postgres data directory after you installed postgres using macports

Find where your launchctl startup script is located.

ps -ef | grep postgres

Outputs

0 54 1 0 0:00.01 ?? 0:00.01 /opt/local/bin/daemondo --label=postgresql84-server --start-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper start ; --stop-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper stop ; --restart-cmd /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper restart ; --pid=none

So I edit

sudo vim /opt/local/etc/LaunchDaemons/org.macports.postgresql84-server/postgresql84-server.wrapper

And find the line

Start()  {         
su postgres -c "${PGCTL} -D ${POSTGRESQL84DATA:=/opt/local/var/db/postgresql84/wrong_place}     start -l /opt/local/var/log/postgresql84/postgres.log" 

}

Ahh.. my data directory is in the wrong place. I fix it by changing

/opt/local/var/db/postgresql84/wrong_place

to

/opt/local/var/db/postgresql84/right_place

for both the start and stop command.

Did you install the postgresql84-server port? If so, did you start the server:

$ sudo port load postgresql84-server

If you did both of those, I've noticed that sometimes the MacPorts daemon handler (daemondo) doesn't start handling requests for PostgreSQL until you restart your machine. (This only happens the first time it is started; subsequent attempts should work fine.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!