Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm trying to get my postgresql to work.

It is clearly running, according to: ps aux | grep postgres | grep -v grep

I am getting -

username            5781   0.0  0.0  2441364    524   ??  Ss    9:05AM   0:00.33 postgres: stats collector process       
username            5780   0.0  0.0  2445216   1628   ??  Ss    9:05AM   0:00.19 postgres: autovacuum launcher process       
username            5779   0.0  0.0  2445084    532   ??  Ss    9:05AM   0:00.14 postgres: wal writer process       
username            5778   0.0  0.0  2445084    576   ??  Ss    9:05AM   0:00.14 postgres: writer process       
username            5777   0.0  0.0  2445084    592   ??  Ss    9:05AM   0:00.00 postgres: checkpointer process       
username            5775   0.0  0.1  2445084   3544   ??  S     9:05AM   0:00.12 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
username            6044   0.0  1.6  2884196  66420   ??  S     9:44AM   0:21.62 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -classpath /Applications/RubyMine.app/plugins/DatabaseSupport/lib/jdbc-console.jar:/Applications/RubyMine.app/lib/util.jar:/Users/username/Library/Preferences/RubyMine50/jdbc-drivers/postgresql-driver-license.txt:/Users/username/Library/Preferences/RubyMine50/jdbc-drivers/postgresql-9.1-901.jdbc3.jar com.intellij.persistence.database.console.RemoteJdbcServer org.postgresql.Driver

But When I try to createuser -s -U $USER

I am getting:

createuser: could not connect to database postgres: 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"?

However, it is clearly running, but just not talking to the correct socket. I tried: sudo find / -name .s.PGSQL.5432 -ls and am getting:

find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
48453370        0 srwxrwxrwx    1 username   wheel    0 Apr 24 11:59 /private/tmp/.s.PGSQL.5432

How do I get psql to talk with the correct socket?

Update:

I checked ls -la under /var/pgsql_socket/.s.PGSQL.5432:

total 0
drwxrwxrwx   2 _postgres  _postgres   68 Sep  19  2011 .
drwxr-xr-x  28 root       wheel      952 Nov   8  2011 ..
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Try the following command:

createuser -h 127.0.0.1 -s new_role 

And if you want to connect your db by using psql interface:

psql -h 127.0.0.1 db_name role_name
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.