安装PostgreSQL 9.1我从官方网站下载PostgreSQL和跑的.dmg安装程序。之后,我下载了pgadmin3,确实能够连接到数据库。如何在OSX狮子
当我运行 'PSQL' 我收到以下错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
google搜索后我读到一些$ PATH问题的时间,所以我要把它放到我的.bashrc:
export PATH=/Library/PostgreSQL/9.1/bin:$PATH
但是,这并不能解决上述错误。经过几个小时的搜索后,我尝试运行'psql -l localhost -U postgres'。这给了另一个错误:
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
经过一些google搜索我尝试编辑/Library/PostgreSQL/9.1/data/pg_hba.conf和更换“MD5”与“信任”的所有事件。
然后,我改变用户的Postgres和执行“pg_ctl停止”和“开始pg_ctl”,切换回我自己的用户,并试图重新连接,没有运气。
这里有一些更多的相关信息:
[~]$ which psql
/Library/PostgreSQL/9.1/bin/psql
ps aux | grep postgres
postgres 19022 0.0 0.0 2446096 484 ?? Ss 11:31PM 0:00.01 postgres: stats collector process
postgres 19021 0.0 0.0 2486532 1776 ?? Ss 11:31PM 0:00.01 postgres: autovacuum launcher process
postgres 19020 0.0 0.0 2486400 576 ?? Ss 11:31PM 0:00.03 postgres: wal writer process
postgres 19019 0.0 0.0 2486400 820 ?? Ss 11:31PM 0:00.05 postgres: writer process
postgres 19017 0.0 0.0 2446096 356 ?? Ss 11:31PM 0:00.01 postgres: logger process
postgres 19015 0.0 0.1 2486400 8216 s001 S 11:31PM 0:00.17 /Library/PostgreSQL/9.1/bin/postgres
sudo find/-name .s.PGSQL.5432
No file was found?!?
更新1: /etc/sysctl.conf中我添加安装程序的README建议的值:
kern.sysv.shmmax=1610612736
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
这些设置之前,安装程序退出时出现错误,之后向导出现并安装postgres(再次使用pgadmin3工作,所以我假定数据库运行正常)。在主流程的所有这一切
你看过服务器日志输出吗?通常在新的OS X上安装Postgres无法启动,因为共享内存限制,请参阅http://willbryant.net/software/mac_os_x/postgres_initdb_fatal_shared_memory_error_on_leopard – bdon 2012-02-19 23:00:10
刚刚检查了日志,只有很多服务器停止和启动消息,没有错误在所有。我将编辑我的文章并添加一个关于共享内存的字词。我想我做了安装程序的自述文件所要求的。 – mbrochh 2012-02-20 07:16:16