2

I'm new to psql, and am having some issues that I think are being caused by a misplaced .conf file. When I tried to log into a database I created earlier I get an error

$ psql corporation
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting

Based on the psql docs it looks like the server isn't running and ps confirms this. Since I don't remember having to start it last time I used psql I was a little confused, but it seemed easy to fix. Unfortunately, my attempts to start the sever have not worked. Using the first method suggested by the docs gets me

$ postgres -D /usr/local/pgsql/data
postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory

While the second method results in

$postgres -D /usr/local/pgsql/data >logfile 2>&1 &
[1] 3165

Ps confirms that neither of these methods started postgres, and when I tried to open the database anyway, to double check, it returns a slightly different error message than before.

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"?
[1]+  Exit 2                  postgres -D /usr/local/pgsql/data > logfile 2>&

How to start PostgreSQL server on Mac OS X? seems related, but has some gaps. Just running initdb wasn't enough, and I don't seem to have a .conf.sample. Do I just need to create a new .conf from scratch or what? For reference I'm running Snow Leopard, I originally tried to manually instal psql, but ended up installing brew then brew installing psql.

Community
  • 1
  • 1
Hunter
  • 995
  • 1
  • 8
  • 7

1 Answers1

2

Have you tried doing a find?

sudo find / -name postgresql*
Anthony
  • 36,459
  • 25
  • 97
  • 163
  • I just tried that and got just tried that and got find: /.Spotlight-V100: Permission denied find: /.Trashes: Permission denied /Applications/Anki.app/Contents/Resources/lib/python2.7/sqlalchemy/dialects/postgresql And so on for more denied permissions than will fit into this comment box. However it looks like it did find a .conf.sample file which for some reason didn't show up when I searched with spotlight. I will see I can apply how to start postgresql server on mac os x's steps from here. Thanks, I'd upvote you, but apparently I don't have enough reputation yet. – Hunter Jan 12 '13 at 01:26
  • Sorry, I should have put sudo at the front. Updated. – Anthony Jan 12 '13 at 01:35
  • Ok, I was able to find a .conf file and change the path I was using so it works now. I don't know why find worked when finder didn't, but the problem is solved. – Hunter Jan 12 '13 at 01:40
  • Sweet. Mark my answer to get a higher rep. And it's okay, the finder only shows files in the userland by default, if I recall. Drives me batty. – Anthony Jan 12 '13 at 06:10