Disclamer: I went through identical titles and none helped me solve my problem.
I installed and started a postgresql server: I first delete pgdata/postmaster.pid
to make sure is not the same problem as other posts. thenpg_ctl start
lsof | grep 5432
lsof | grep 5432
-> nothing
pg_ctl start
-> ...listening on Unix socket "sockets/.s.PGSQL.5432"...database system is ready to accept connections... lsof | grep 5432
lsof | grep 5432
-> postgres 1495 username 4u unix 0x0000000000000000 0t0 16163716 sockets/.s.PGSQL.5432 type=STREAM
then I go for: rake db:setup
and I get:
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Couldn't create 'seqresults-test' database. Please check your configuration.
rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Then I can access the database with the client.
$ psql
then
postgres=#
Help please. All this looks like black magic to me and it's not working.
I will also appreciate if someone could briefly explain how does this work.
Looks like your postgres is listening on a unix socket (a special kind of file), not a tcp one.
You can try connecting via that socket (location on your system will probably be different, you need the directory where .s.PGSQL.5432
file is located):
# database.yml
host: '/var/run/postgresql'
database: ...
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.