在我做了brew更新和brew升级之后,我的postgres遇到了一些问题.我试图卸载postgres并重新安装,但它也没有用.
这是错误消息.(当我尝试执行rake db:migrate时,我也收到此错误消息)
$ psql
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
Mac版:山狮.
自制版:0.9.3
postgres版本:psql(PostgreSQL)9.2.1
这就是我所做的.
12:30 ~/D/works$ brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.2.1...
12:31 ~/D/works$ brew uninstall postgresql
Uninstalling /usr/local/Cellar/postgresql/9.1.4...
12:31 ~/D/works$ psql --version
bash: /usr/local/bin/psql: No such file or directory
12:33 ~/D/works$ brew install postgresql
==> Downloading http://ftp.postgresql.org/pub/source/v9.2.1/postgresql-9.2.1.tar.bz2
Already downloaded: /Library/Caches/Homebrew/postgresql-9.2.1.tar.bz2
......
......
==> Summary
/usr/local/Cellar/postgresql/9.2.1: 2814 files, 38M, built in …Run Code Online (Sandbox Code Playgroud) 我设法让我的本地开发环境变得笨拙.
我所有的本地Rails应用程序现在都给出错误:
PGError
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)
我不知道是什么造成的.
在搜索解决方案时,我更新了所有捆绑的宝石,更新的系统宝石,更新的MacPorts.没有快乐.
其他人在从OSX Leopard升级到Lion时报告了这个问题,因为混淆应该使用哪个版本的Postgres(即OSX版本或MacPorts版本).我已经在Lion运行了几个月,所以现在这应该发生似乎很奇怪.
如果不先了解问题是什么,我就不愿意过多地捣乱.如何有条不紊地调试?
如何确定我的系统中有多少版本的PostgreSQL,正在访问哪一个版本以及它所在的位置?如果使用错误的PostgreSQL,我该如何解决这个问题?
抱歉没有问题.我还在学习它是如何工作的!谢谢你的任何指示.
编辑
一些更新基于以下建议和评论.
我试图运行pg_lsclusters哪个返回command not found错误.
然后我尝试本地化我的pg_hba.conf文件并找到这三个示例文件:
/opt/local/share/postgresql84/pg_hba.conf.sample
/opt/local/var/macports/software/postgresql84/8.4.7_0/opt/local/share/postgresql84/pg_hba.conf.sample
/usr/share/postgresql/pg_hba.conf.sample
Run Code Online (Sandbox Code Playgroud)
所以我假设安装了3个版本的PSQL?Macports,OSX默认和???.
然后我搜索了ps -ef | grep postgres返回的launchctl启动脚本
0 56 1 0 11:41AM ?? 0:00.02 /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
500 372 1 0 11:42AM ?? 0:00.17 …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行rake db:create或rake db:setup但是我收到以下错误.这很奇怪,因为rake db:create它与其他Rails项目的其他文件夹一起工作正常.
user:project user$ rake db:create
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord- 3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:991:in `initialize'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord- 3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:991:in `new'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:991:in `connect'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:260:in `initialize'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:27:in `new'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/postgresql_adapter.rb:27:in `postgresql_connection'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord- 3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in `new_connection'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in `checkout_new_connection'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord- 3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block (2 levels) in checkout'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord- 3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `loop'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in `block in checkout'
/Users/user/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in `checkout'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in `connection'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in `retrieve_connection'
/Users/user/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:107:in `retrieve_connection' …Run Code Online (Sandbox Code Playgroud)