rob*_*rob 3 postgresql macos rails-4-2-1
我刚刚将我的mac OS X更新为Yosemite,版本10.10.4,并将postgresql更新为:psql(PostgreSQL)9.4.4.
在我的Rails 4.2.1应用程序上运行rake db:migrate后,我的终端会话响应:
rake aborted!
PG::ConnectionBad: 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" (::1) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
在我的终端会话中简单地输入psql也会显得有些偏差:
$ 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)
从cat /usr/local/var/postgres/server.log中打印出日志后,我读到:
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.4.
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
Run Code Online (Sandbox Code Playgroud)
我在SO上找到了这个答案,但是我开始创建一堆目录时犹豫不决,除非那是我真正想做的事情.我也找到了一个较旧的答案,但我不太确定是否应该遵循.
这个SO答案表明我删除了一个/usr/local/var/postgres/postmaster.pid,但我没有,我有一个/usr/local/var/postgres/postmaster.opts - 我应该删除postmaster.opts?
似乎有很多建议,但我不太清楚要遵循什么.有人可以提供一些建议让我的postgresql数据库在我的rails应用程序上运行吗?
ada*_*sko 12
您可以按照官方指南升级数据库:
brew switch postgres 9.3 # presuming you already installed 9.4.4
pg_dumpall > outputfile
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres.old
brew switch postgres 9.4.4
initdb -D /usr/local/var/postgres
psql -d postgres -f outputfile
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1121 次 |
| 最近记录: |