there r too many questions about my problem. but none of them are not just like mine. so i needed to ask it again. when i try to execute some command on postgresql i take this error :

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

postgresql is running. here is the ps auwwx|grep postg output :

postgres  2857  0.0  0.0   6056  1668 pts/4    S    01:13   0:00 su postgres
postgres  2866  0.0  0.0   5804  1888 pts/4    S    01:13   0:00 bash
postgres 15543  0.0  0.1  44580  6256 pts/4    S    01:41   0:00 /opt/PostgreSQL/9.1/bin/postgres -D /opt/PostgreSQL/9.1/data
postgres 15544  0.0  0.0  14616   808 ?        Ss   01:41   0:00 postgres: logger process                                    
postgres 15546  0.0  0.0  44564  1172 ?        Ss   01:41   0:00 postgres: writer process                                    
postgres 15547  0.0  0.0  44564  1164 ?        Ss   01:41   0:00 postgres: wal writer process                                
postgres 15548  0.0  0.0  45124  2148 ?        Ss   01:41   0:00 postgres: autovacuum launcher process                       
postgres 15549  0.0  0.0  14908  1240 ?        Ss   01:41   0:00 postgres: stats collector process                           
alix     17375  0.1  0.0   5684  1952 pts/4    S+   02:00   0:00 nano postgresql.conf
alix     17445  0.0  0.0   4628   840 pts/0    S+   02:01   0:00 grep --color=auto postg

and here is my postgresql.conf file :

# - Connection Settings -

#listen_addresses = 'localhost'         # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost', '*' = all
                                        # (change requires restart)
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)
# Note:  Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3     # (change requires restart)
unix_socket_directory = '/var/run/postgresql'           # (change requires restart)
#unix_socket_group = ''                 # (change requires restart)
#unix_socket_permissions = 0777         # begin with 0 to use octal notation
                                        # (change requires restart)

my ls -lA /var/run/postgresql output :

total 0

my pg_hba.conf :

local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5

i reinstalled many many times postgresql. purged it removed it.purged it like postgresql* and reinstalled it. but its still same.. i dont know what to do. i am done.

thank you.

share|improve this question
post pg_hba.conf as well please – fvu Aug 3 '12 at 23:17
i posted it.thank you – drTerminal Aug 3 '12 at 23:24
you seem to have two lines for local in pg_hba.conf, is that intentional? – fvu Aug 3 '12 at 23:27
no. i didint change anything in conf files. – drTerminal Aug 3 '12 at 23:32
I'd comment out the first local line, just leaving the second, to avoid confusing the server – fvu Aug 3 '12 at 23:41
show 15 more comments
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

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

Browse other questions tagged or ask your own question.