I was getting the famous
psql: 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"?
error when trying to createdb
in the Terminal in OSX Mountain Lion, so following the instructions here, I added export PATH=/opt/local/lib/postgresql92/bin:$PATH
to my .bash_profile
and now if I type which psql
I get /opt/local/lib/postgresql92/bin/psql
(where previously I was getting /usr/bin/psql
).
However, if I try createdb database
now, I get prompted for a password I don't know (it's not my default user password), and if I enter it wrong twice, I get:
createdb: could not connect to database template1:
FATAL: password authentication failed for user "username"
where username
is my default username in Terminal. What I'm trying to do is create a PostgreSQL database I can access from a Django project living inside a virtualenv. I'm using PostgreSQL 9.2. What am I doing wrong?