PG :: Upgrade ConnectionBad to Yosemite and postgresql 9.4.4

I just upgraded my Mac OS X to Yosemite, version 10.10.4 and postgresql: psql (PostgreSQL) 9.4.4.

After running rake db: migrate in my Rails 4.2.1 app, my terminal session responds with:

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?

      

Just typing psql into a terminal session also looks a bit like:

$ 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"?

      

After printing the logs from cat / usr / local / var / postgres / server.log, I read:

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

      

I found this answer on SO, but I'm hesitant to just start creating a bunch of directories, if that's really what I'm supposed to do. I also found an older answer , but not too sure if it will follow.

This SO answer assumes that I am deleting the /usr/local/var/postgres/postmaster.pid file, but I do not have it, I have, /usr/local/var/postgres/postmaster.opts - postmaster.opts should be deleted ?

There seems to be a lot of advice, but I'm not too sure what to do. Can anyone suggest any advice for getting my postgresql database on my rails app?

+3


source to share


2 answers


Basically, I had to drop and recreate my own database and reload it with remote staging data. What I didn't realize was that the problem with updating the database is that the data itself needs to be "updated" in some sense as well. The data was compatible with another version



0


source


You can update your database by following the official guide:

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

      



PostgreSQL update

+12


source







All Articles