简体   繁体   中英

Errors when connecting to local Postgres.app from Navicat or Induction

Ok, so I have Postgres.app on my mac.

It's running locally insofar as I know. (the little elephant icon in top bar)

Created a very basic rails application, and it worked fine, ie, it showed up in browser.

Trying to connect it to Navicat Lite http://www.navicat.com/ . It keeps coming up with this error: FATAL: role "postgres" does not exist.

Can't quite figure out how to solve this, so I happened to come across Induction http://inductionapp.com/ and tried to use it to connect to Postgres again, and this is the error it comes up with:

Connection Error
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"? 

Not really sure how to solve this.

Have googled around on this, and some of the fixes seemed a little complicated, and right now, don't want to do fixes that I can't quite understand nor rollback.

Halp?

EDIT (including my bash info)

export PGHOST=localhost
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export PATH=/usr/local/bin:$PATH
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

EDIT TWO

Ok, not sure how this happened of sorts.

Was randomly running Navicat again (sort of like a mouse in a running wheel?), and changed a few of the data entered on 'Connection Properties' page, ie, username and password - set it to what my laptop's info is.

It worked.

So, yay?

But then when I tried it with Induction, got the same error as listed in this post.

So, not sure what's going on, and why simply it works for Navicat and not Induction?

EDIT THREE

Hm ... ok, just tried Induction again, and actually typed localhost this time instead of leaving it to their default of 127.0.0.0 ... and it worked!

Hm, is this good news?

Also, the results of 'which psql' is this: /usr/bin/psql which doesn't seem right to me, given what I've put in my bash profile.

Um, not trying to prolong this post, nor add questions that could be saved for another post. I guess technically since I've got both Navicat and Induction working that this post is now invalid?

Should I make my question about psql path another post?

Please let me know.

Thank you.

Have removed results of echo $PATH.

Seems like your rails app is trying to connect to the standard postgres installation that is shipped with OSX vs. the postgresapp.

Have you followed these steps as part of the postgresapp setup ( http://postgresapp.com/documentation )?

PostgreSQL ships with a constellation of useful binaries, like pg_dump or pg_restore, that you will likely want to use. Go ahead and add the /bin directory that ships with Postgres.app to your PATH (preferably in .profile, .bashrc, .zshrc, or the like to make sure this gets set for every Terminal session):

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

Once your path is correctly set up, you should be able to run psql without a host. (If not, check that the correct version is being loaded in the PATH by doing which psql)

Also, re-install your pg gem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM